How do I search for a decimal number?

0 votes

I have used this regex formula

(^6|^6.[0-9]) (years| experience)

to search experience with year that start with 6 but I'm not sure this is right. Help?

asked Apr 13 by origin (50 points)
edited Apr 13 by origin

1 Answer

0 votes

Try this:

(?<![0-9.])6(.[0-9]+)? years

This will match:

6 years
6.25 years
6.9 years

If you optionally want to search for the word experience as well add ( experience) at the end, e.g.

(?<![0-9.])6(.[0-9]+)? years( experience)?
answered Apr 13 by dave (49,630 points)
edited Apr 15 by dave
but it also shows like
5.6,0.6,.. etc
ah, yes. I've edited the answer to check the the preceding character is not a number or a decimal point.
Is it possible  to search for the file that contain text six years/experience  with your above code??
six years( experience)?