How to get the number at the end of the line?

I want to get a sequence of numbers that is at the end of a line. eg.

string contentDbIndex = Regex.Match("ab56cd1234", @"\d+").Value; 

gives a result of 56 , but I want the result to be 1234 . How can I do it?

+6
source share
1 answer

You can use the end of the anchor ( $ ) as follows:

 string contentDbIndex = Regex.Match("ab56cd1234", @"\d+$").Value; 
+19
source

Source: https://habr.com/ru/post/944863/


All Articles