How to get only numbers as substring using Regex?

Hello all,

I have strings that look like this:
Buy now 14 000 $
Buy now 22 450 $
Buy now 19 500 $

How can I capture numbers only using Regex?

edit 1: I tried to use \d+ expression but that capture numbers before space(in my case: 14, 22, 19…)

Thanks in advance :pray:

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(text,"(?<= )[ \d]+(?= \$)").Value

Regards,

@Yoichi thank you mate! It works!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.