Hi
Could someone help me please? I would like to find line number where it found the match.
The php code looks like this:
$strings = "213;314;567;4722";
$search = "314";
if( preg_match_all('/('.preg_quote($search,'/').')/i', $strings, $matches,PREG_OFFSET_CAPTURE)){
foreach($matches[1] as $match){
$line = 1+substr_count(substr($strings,0,$match[1]), ";");
echo "Found $search on $line";
}
}
What I got so far:
strings_to_search = "213;314;567;4722";
line_match = 1 + StrCount( strings_to_search, ";" );
printf( "\nline_match:" + line_match +"\n");
search_string = "314";
foundmatch = StrMatch( strings_to_search, "*"+search_string+"*" );
printf( "\nfoundmatch:" + foundmatch +"\n");
Thanks in advance.