-2

I have string like below i want to extract the number from the string. so i have used the following regex,it is not removing the last bracket even though i have used global replace.how to write the regex so it removes all the non digit characters even it is in the beginning or in the end

enter image description here

2
  • Why not just use a number capture group? Commented Jul 13, 2018 at 6:57
  • Remove ^ anchor. Commented Jul 13, 2018 at 6:57

1 Answer 1

0

Your regex means : get the non digit from the start of the string, and end with non non digit (= digit), that's the reason your result come from.

If you want to get the number and the string's style is the same.You can use this:

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks this is what i am expecting

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.