Regex - search for 2 words in a string -
i have next lines in text file (simple example, actual text file need work in 7,000 lines long):
the kitchen delivery arrived in afternoon dad helped install kitchen , worked through until midnight later on dad ate cheese sandwichi trying utilize regular look search lines containing words "dad" , "kitchen". don't have next each other, somewhere on line.
in illustration above, 2nd line should found.
i have tried:
[kitchen] dad
but matches 2nd , 3rd lines, presumably because [kitchen] says find lines containing of characters, rather entire word, , and words containing "dad".
i tried:
[\bkitchen\b] dad
but doesn't work either.
apologies posting question, seemingly @ risk of beingness blocked on stackoverflow asking more questions because questions have not been received, i'm not sure why, seek inquire clear questions...
any advice much appreciated.
thanks
either dad followed kitchen:
dad.*kitchen
or kitchen followed dad:
kitchen.*dad
putting 2 together:
(dad.*kitchen|kitchen.*dad)
also, remember case sensitivity.
regex
No comments:
Post a Comment