Link to home
Start Free TrialLog in
Avatar of tmajor99
tmajor99

asked on

Regular Expression to find multiple words

I need a regular expression that will check if a string contains words "Wall Mount"  and ("Inwall or "in-wall" or "in wall").  

Data
-------------------------------------------------


Wall Mount (Inwall Frame/Plate)                 Match
Wall (Inwall)                                                     Not Matched
Wall Mount (In-Wall)                                      Match
Wall Mount InWall                                         Match
In Wall MNT                                                    Not Match
IN-WALL  (WALL Mount)                              Match
ASKER CERTIFIED SOLUTION
Avatar of wilcoxon
wilcoxon
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bill Prew
Bill Prew

This should also work too...

(?i)(?=.*wall\s+mount)(?=.*in[-\s]*wall)

Open in new window


»bp
And if you want the chunks you are matching to be disjoint "words" and not allow subwords, like

thinwall Wall Mounting

the try:

(?i)(?=.*\bwall\s+mount\b)(?=.*\bin[-\s]*wall\b)

Open in new window


»bp
@tmajor99,

Are you all set with this now, or do you need more help?  If all set, could you please close it out now.  If you need help with the question close process take a look at:



»bp