I have an regular expression, wich works fine in Java or python, but I don't seem to be able to make it work in postgres. Regular expression needs to match everything begining with '+' (plus sign) or letters 'STOP', 'stop', 'StoP', or any other combination pronounced 'stop'.
Here is the python example: >>> import re >>> p = re.compile(r'^\s*(?:[\+|-]|(?:[sS][tT][oO][pP]\b)).*$') >>> p.match('+mario').group(0) '+mario' >>> p.match('+mario works').group(0) '+mario works' >>> p.match('mario works').group(0) Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'NoneType' object has no attribute 'group' >>> p.match('stop works').group(0) 'stop works' >>> Now, here is what happens if I try this in postgres: pulitzer2=# select '+mario' ~ '^\s*(?:[\+|-]|(?:[sS][tT][oO][pP]\b)).* $'; ?column? ---------- t (1 row) This one is ok. pulitzer2=# select '+mario works' ~ '^\s*(?:[\ +|-]|(?:[sS][tT][oO][pP]\b)).*$'; ?column? ---------- t (1 row) This one is also ok. pulitzer2=# select 'mario works' ~ '^\s*(?:[\ +|-]|(?:[sS][tT][oO][pP]\b)).*$'; ?column? ---------- f (1 row) Same as this one, also ok. pulitzer2=# select 'stop works' ~ '^\s*(?:[\ +|-]|(?:[sS][tT][oO][pP]\b)).*$'; ?column? ---------- f (1 row) Here, postgres should return true, but it gives me false. I'd appreciate any hints on what is wrong here. Thank you in advance, Mario -- Mario Splivalo Mob-Art [EMAIL PROTECTED] "I can do it quick, I can do it cheap, I can do it well. Pick any two." ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org