I am having problems extracting values from a given string using RegEx match, the string which I am working with is below.
533 x 1981mm, 35mm Thick - Non Fire Door: £33.14
The RegEx I have is, which works fine if the string is as follows
533 x 1981mm, 35mm Thick: £33.14
^(?<first>\d+)\s*x\s*(?<second>\d+)mm,\s*(?<third>\d+)mm Thick: £(?<price>\d+\.\d+)$
My question is, how can I change the RegEx to ignore anything between the last 'mm' and the '£' sign?
What my code does it extract millimetre measurements, converts them into inches and returns a string to my method. The rest of the code is as follows.
var first = Int32.Parse(match.Groups["first"].Value);
var second = Int32.Parse(match.Groups["second"].Value);
var third = Int32.Parse(match.Groups["third"].Value);
var price = Decimal.Parse(match.Groups["price"].Value, CultureInfo.InvariantCulture);
Thank you gurus!
^(?<first>\d+)\s*x\s*(?<second>\d+)mm,\s*(?<third>\d+)mm .* £(?<price>\d+\.\d+)$do the trick?