tmajor99
asked on
Regular Expression - Check for word in a string
I need a regular expression to check for a word in a string that has a "/".
Value
---------
40005 Btu/h ----> I need to detect if the value has "Btu/h"
5009 BTU/H ----> I need to detect if the value has "BTU/H"
6999 BTU -----> I also need to detect if value has just "BTU".
6700
900000 Btu
Value
---------
40005 Btu/h ----> I need to detect if the value has "Btu/h"
5009 BTU/H ----> I need to detect if the value has "BTU/H"
6999 BTU -----> I also need to detect if value has just "BTU".
6700
900000 Btu
Or did you specifically want the given combinations of upper/lower case?
ASKER
Yes, this needs to be case sensitive. Also, this did not work. I need an expression that would cover all the scenarios listed below.
Value
---------
40005 Btu/h ----> I need to detect if the value has "Btu/h"
5009 BTU/H ----> I need to detect if the value has "BTU/H"
6999 BTU -----> I also need to detect if value has just "BTU".
6700
900000 Btu
Value
---------
40005 Btu/h ----> I need to detect if the value has "Btu/h"
5009 BTU/H ----> I need to detect if the value has "BTU/H"
6999 BTU -----> I also need to detect if value has just "BTU".
6700
900000 Btu
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
with the case insensitive option active.Demo:
https://regex101.com/r/jddy9t/1