I want to find a given sub string that exist or match in a big string.
-> a given sub string can contain \n \r \r
I try
if(preg_match("`".$sub_str."(.*)`im", $str, $matches)){
//DO something when it true
}
for that case I did not know what can be the problems with any given sub string?
Modifier
iis case insensitive flag.Modifier
mis multiline flag.This is, from what I can tell at a very quick glance, a terrible way of doing:
The regular expression is simply finding (in a case-insensitive, multiline-aware manner) a (
$find_it) within another string ($str) and placing everything after that into a capturing group (within $matches). The above is a loose match of the code, just faster.Answering your question directly,
preg_matchwould return false when$find_itdid not exist within$str.