Jump to content

Multiple Words, Any Order


bsmither

Recommended Posts

I found this regex, which is what I want, here:

 

(?=.*\bdog\b)(?=.*\bpuppet\b)(?=.*\bfuzzy\b)

It is suppose to 'succeed' if it can find all the given words in any order.

 

Yet, when I try to test it against this sequence of words (or any other order of these words):

 

need fuzzy hand puppet in dogpen for dog

I get no indication of a match.

 

What am I not understanding?

Link to comment
Share on other sites

Interesting. Other than using your browser's javascript console, do you (or anyone here) have a console app that succeeds in showing a true result?

 

Such as:

http://forums.phpfreaks.com/topic/282231-at-last-regexbuddy-4-released/

 

Personally, I tried with The Regex Coach (v0.9.2, copyright 2008, Dr. Edmund Weitz) and Rad Software Regular Expression Designer (v1.4, copyright 2007, Ross Donald). May be I don't know how to use the Rad Software app.

Link to comment
Share on other sites

Thank you for your assistance with this. It has proved to be enlightening,

 

To close this out, the expression I needed is to be used in a MySQL query. From the actual source code I was trying to modify, I knew the word boundary indicator is different. But there is more.

 

I have also come to learn MySQL uses the POSIX language for it's RE engine, which means there is no lookahead.

 

However, regardless of whether it is efficient or not, I will probably have to use:

 

(`abc` RLIKE expr1) AND (`abc` RLIKE expr2) AND ...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.