Regex get last number in string

Hi !

Can someone plz help me to extract last number in strings using Regex ?

here some examples:

1: "ksdhfkjsdhf 12"

2: "sdfsd fd sdfsdf 333"

3: "jgjhhhjdfg15"

the result should be:

12

333

15

Thanks !!!

[269 byte] By [zubziro] at [2008-2-14]
# 1
Does your text to search include the 1: and the quotes, or is is just the bit between the quotes?

Something like this should work if it DOES include that (in fact, it will work even if it doesn't):

(\d+)"*$

I strongly recommend downloading Regexp Builder from:

http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=9e33c395-8275-4906-8a09-0bff41fdc1d6

It will let you easily play around with different search text and search expressions. Well worth it!

MatthewWatson at 2007-8-30 > top of Msdn Tech,.NET Development,Regular Expressions...
# 2

Thanks for your answer !

text does not include the 1: and the quotes.

I will try RegExp Builder

Bye

zubziro at 2007-8-30 > top of Msdn Tech,.NET Development,Regular Expressions...
# 3

here is also a good tool for Regular expression

http://tools.osherove.com/CoolTools/Regulator/tabid/185/Default.aspx

:)

SoeMoe at 2007-8-30 > top of Msdn Tech,.NET Development,Regular Expressions...

.NET Development

Site Classified