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
Asked
Active
Viewed 39 times
-2
-
Why not just use a number capture group? – Andrew Li Jul 13 '18 at 06:57
-
Remove `^` anchor. – Wiktor Stribiżew Jul 13 '18 at 06:57
1 Answers
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:

rolin.tencent.Shenzhen
- 174
- 9