Do i need a Regex for this?

Mondeo

Centurion
Joined
Nov 10, 2006
Messages
128
Location
Sunny Lancashire
Hi,

If I have the following strings

Vauxhall Corsa 1.2 XS 5 Door
1.4 Citroen Saxo Red
Ford Escort Si 1.6i

I need to pass them to a function and get the engine sizes out. So for these examples

1.2
1.4
1.6

All the engine sizes will be in the same format number - full stop/period -number.

I'm guessing regex might do it but never used before.

Thanks
 
Regex is a perfect candidate for this.

Something like Regex.Match would probably do the trick. The regular expression might look something like [0-9]\.[0-9] which says "any single digit 0-9 followed by a . followed by any single digit 0-9.
 
Back
Top