-1

I have something like this: Cat= "I cost £3,000"

And some are like this: AnotherCat= "that other cat is just £10 more expensive than mine £2990

I want to parse out just 3000 from cat and 2990 from Another Cat

rizu
  • 1,047
  • 1
  • 12
  • 21
  • And what will happen with 10 from AnotherCat? Check [this](https://stackoverflow.com/questions/4734116/find-and-extract-a-number-from-a-string) similar question. Maybe it'll help you. – LeviTheOne Nov 11 '18 at 09:30
  • @LeviTheOne I don't necessarily need 10 and to add to the question sometimes I might just need 10 and not 2990 – rizu Nov 11 '18 at 09:32

1 Answers1

0

Your question is much more complicated then parse number from string. If you just want to extract all number from string you can use next regex:

var result = Regex.Matches(stringValue, @"\d+");

but if you want to to understand, where is price of something, but not a count of cats, for example, it is related to Artificial Intelligence and Machine Learning.

Sergey Shulik
  • 950
  • 1
  • 9
  • 24