Leandro-AL wrote:Ok that worked thanks a million!
You're welcome.
Leandro-AL wrote:So this is sort of confusing. i thought that by placing \m in the end the ^ and $ will check what's in between them for each line... or?
Cause according to my thought the first line would match for "first line" and the second would skip "\n" and go to "second line"
No, by doing
/^[a-z]+$/m the preg_match(...) function just looks if there's a match in the input string. And it finds "second line". However, if you want to match the entire string, not just separate lines. So you have no need to use the multi-line option: you want ^ to be the start of the string (NOT the start of each line) and you want $ to be the end of the string (NOT the end of each line), hence the final regex:
/^[a-z\s]+$/ where
\s will match the spaces and new line characters (and tabs).
Does that make sense? If not, don't hesitate to ask for clarification!
HTH