tags:

views:

78

answers:

2

I need 2 regular expressions that I will use in MySQL

  • OK if one of the url parameters equals something (e.g page_id=5)
    I came up with this: ^https?:.*[?&]page_id=5([#&].*)?$

  • OK if a certain parameter is not present in the url (e.g do not match [?&]page_id=)
    This is the one I need help with.

This functionality is part of a bigger problem that does need to be implemented with regular expressions and they have to be compatible with MySQLs RLIKE

+1  A: 

your regexp looks fine - just use NOT RLIKE

Igor
Unfortunately I can't, it's a preset SQL template which I can no change, and I have to use RLIKE
duckyflip
+1  A: 

AFAIK, MySQL's regex library does not support look-aheads, which is necessary for this kind of thing. As already stated, NOT RLIKE seems to be the only option.

Bart Kiers