Hi!
I just had a look at the sticky thread mentioned in the subject and I think it should be quite useful for starters.
I just like to add one small advise:
I'm not a python programmer, but I'm using perl for almost 20 years now and I'd like to draw your attention to the fact that (?flag) in perl is taking effect from the place where you put the flag up to the end of the surrounding group. So that regexp would only match "test" but not "Test" or "TEST".
Well, you may object, in python it's different and in fact http://www.pythonregex.com/ suggests so.
Nevertheless I'd strongly advise to not put the flags anywhere in the regexp, but just at the beginning. This will make things much easier and additionally, follows the python regular expression documentation which states:
So instead of
better use
I just had a look at the sticky thread mentioned in the subject and I think it should be quite useful for starters.
I just like to add one small advise:
Quote:
For ignoring case, the flag is "i", thus you include "(?i)" in your expression. Thus, Code: Code:
test(?i) |
Well, you may object, in python it's different and in fact http://www.pythonregex.com/ suggests so.
Nevertheless I'd strongly advise to not put the flags anywhere in the regexp, but just at the beginning. This will make things much easier and additionally, follows the python regular expression documentation which states:
Quote:
Note that the (?x) flag changes how the expression is parsed. It should be used first in the expression string, or after one or more whitespace characters. If there are non-whitespace characters before the flag, the results are undefined. |
Code:
test(?i)
Code:
(?i)test