0

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

2 Answers 2

1

your regexp looks fine - just use NOT RLIKE

Sign up to request clarification or add additional context in comments.

1 Comment

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

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.