I have a simple regex code to match a whole line in text file that has a specific word. I use PHP function preg_match_all.
this is my regex pattern:
$word= 'world';
$contents = '
this is my WoRld
this is my world
this is my wORLD
this is my home
';
$pattern = "/^.*$word.*\$/m";
preg_match_all($pattern, $contents, $matches);
// results will be in $matches[0]
this function get the full line but search for case sensitive only so it will return the second line only of the text.
I want it to match all line (that has "world" word in any form).
I read about using /i but I don't know how to combine it with the pattern above.
I tried:
/^.$pattern.\$/m/i
/^.$pattern.\$/m/i
/^.$pattern.\$/i