0

I cant seem to get the following search query to work in phpMyadmin.

 SELECT * FROM `my_table` WHERE `content` REGEXP 'https?\:\/\/(.*?(?<!cgi\.)ebay)';

Here is the error that I get:

 #1139 - Got error 'repetition-operator operand invalid' from regexp 

The regular expression itself works perfectly fine when I created it so not sure what is the problem, see here: http://regex101.com/r/qN2jX4/1

4
  • What's the matter with SELECT * FROM my_table` WHERE content LIKE 'http%ebay';` Commented Sep 28, 2014 at 23:39
  • That gives no results. The ebay link has to be anything except cgi.ebay Commented Sep 28, 2014 at 23:53
  • SELECT * FROM my_table WHERE content NOT LIKE '%cgi.ebay%'? Commented Sep 28, 2014 at 23:58
  • That will not work because that table does not only contain ebay links with or without the cgi subdomain. It will give me all link types as well as useless text. It has to be something that tell to query something that a url and has ebay in it but does not have cgi in front of it. Commented Sep 29, 2014 at 0:54

1 Answer 1

2

The .*? looks suspect as does the ?<. Removing the extra ? fixes the error:

WHERE `content` REGEXP 'https?\:\/\/(.*(<!cgi\.)ebay)';

Perhaps this does what you want.

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

4 Comments

good one, tried different things and good to see the solution.
Thanks, this stopped giving me an error but gives 0 results. I cant figure out whats is wrong because I'm sure I have many URLs that look like www.ebay and more non-cgi .
I did some more research and read that MySQL may not have the negation operator "?!" ? Anyway, I tried another option but it also removes urls like i.ebay.com or anything with one of the threaa letters , not actualy the full phrase: REGEXP 'https?\:\/\/[^(cgi|mobile)]*\.ebay'
@user1745382 . . . If you want help solving the real problem rather than the syntax issue, ask another question, describe the logic that you want, and give examples of content that you want to pass and fail the test.

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.