"(.)* matches any number of characters, except newline. "
Not quite; it matches zero or more characters including newlines. It's just the regexp interpreter who will only compare the regexp against one line at a time if you don't tell it to span accross multiple lines.
A few more notes:
1. parentheses are not required unless you want to backreference/extract the middle part
2. the i after the pattern makes the match case-insensitive, this may not be what you want.3. this:
preg_match("/xyz(.)*0001/i", "xyz(blah)0001")
will also match on
"this is xyz my line 0001 that continues here"
even though it clearly does not start with xyz nor end with 0001.
To force the xyz and 001 at the beginnin and end, use 'start of string' and 'end of string' markers:
So the final regexp would be:
"/$xyz.*0001/"
(add the 'i' if the match should be case-insensitive)
A forum, a FAQ, email notification, what else do you need?