Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regexp for search engine

Status
Not open for further replies.

grtfercho

Programmer
Apr 11, 2003
424
US
Normally I do good with RegExp, but this time I'm kinda stucked.

I'll use the pipe (|) as begin/end delimiter.
User enters a string like

Code:
|"google search" syntax verity|

boss wants that string to be transformed into

Code:
|"google search" AND syntax AND verity|

Basically create ONE ( and only one regexp) that finds any whitespace outside the double quotes and transform it into an " AND " (space_AND_space).
I say it has to be done in a couple of lines of code, boss says there's got to be a way to do it in one regexp without too much effort. I disagree.

If anybody out there could create this magical regexp please post it here...
THanks!!!

grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
why use 1 regex? does it matter as long as you get the same result? for that matter why not use a CF solution if you can't get the regex to work? Is your bosses nose where it doesn't belong?


We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
I know!!! ;)

I just want to know that it cannot be done in one regexp.
Is more of a challenge now...

Thanks.

grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
I imagine that it IS possible, regex is pretty cool stuff. I'm not the one to tell you how to do it but it seems like it's possible.

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top