user3699288
user3699288

Reputation: 1

Writing a regular expression with decimal values

I need to write a regular expression for use in Google Course Builder. The expression needs to accept 22.69 - 23 inclusive.

The decimals are beating me! Help would be greatly appreciated. Google Course Builder uses expressions in this format: \b0*(2[89]|[34][0-9]|50)\b

Upvotes: 0

Views: 54

Answers (1)

woot
woot

Reputation: 7616

If I break it down, I think you are looking for these matches:

 \b0*(22\.69[0-9]*|22\.[7-9][0-9]*|23|23\.0*)\b

That is:

22.69
22.7*
22.8*
22.9*
23
23.0...

Does that regex work for your use? Also, I'm not sure which regex it is, you might need to escape the decimal.

Upvotes: 1

Related Questions