When the 'm' (multi-line option) is used, every line in your text matches ^.*$, so the ^ does not only match the start of the string and $ does not match only the end of the string.
Hmm... so what can i do? Any suggestions? Maybe remove ^ $ ?
I want to create a pattern that will match letters, numbers, punctuation and some more characters (including apostrophe) through a block of code as can be an email body.
Ok guys sorry im sort of a newbie here and i don't totally understand... so how would i write a pattern that checks multiple lines if they contain, say, only lowercase letters [a-z].
Cause you keep bringing up the dot although i dont have it in my pattern so this is confusing me a bit...
Last edited by Leandro-AL on Sun Sep 28, 2008 2:51 pm, edited 1 time in total.
If you mean "the last line should contain only lowercase letters" then you are almost there
No, i mean i want to make sure that the message from the first letter to the last and from the first line to the last is only made of letters (for simplicity).
The regexp you want is so elementary that I simply can't believe you've read these tutorials...
Don't take me wrong, I rarely refuse to help people in this forum, but I think that it is more important to one to learn something, instead of copy-paste solutions ...
There are 10 types of people in this world, those who understand binary and those who don't
And i already said that i've got some knowledge on regex (more or less as much as i need) and that i'm obviously missing something small here and that i've already tried searching about it.
Sometimes it's better to give people a 10 letter piece of code than referring them to a "regexp tutorial" google search link.
Leandro-AL wrote:Actually i have read a lot of tutorials and i've got this book that has a whole chapter on it too. I have managed everything else except this!
...
I don't know exactly what the problem is. Could you post the some examples that need to be positively matched and some example text that should not?
only the last line is checked, so as long as the last line contains only lowercase letters, the whole text flags for valid, which shouldn't happen. This thing here shouldn't flag valid but it does: