Brandon Wilson
Brandon Wilson

Reputation: 4600

Regex Number Below 90

I need to validate that percent complete is < 90.00, so basically 89.99 and below.

I was able to get regex to work with whole numbers:

^(?:[0-9]|(?:[1-8][0-9]))$

However, I need to be able to match one the decimal too and find it within the below string.

Endpointgroup Name::ALL::Endpointgroup Description::::SQLRun TS::2017-06-19 14:15:02::ORIGINAL_NODE=CE01::ORIGINAL_NODE=CE01::Total EP::940256::Completed EP::869655::Job Status::W::Percent Complete::92.49

Upvotes: 2

Views: 582

Answers (2)

Kosh
Kosh

Reputation: 18413

This will capture strings where the number following the Complete:: is less or equal 89.99. You can get the number from the first capturing group.

Complete::([0-8]?[0-9]\.[0-9][0-9])

Upvotes: 1

Aman Kumar
Aman Kumar

Reputation: 232

It is quite ugly to do with regex. See the posts

Validate max-min with regex and Use regex to compare numbers

Upvotes: 0

Related Questions