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:


How about the following expression?

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


@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.