[Javascript] RegExp for parsing search strings
Scott Reynen
scott at randomchaos.com
Fri Apr 28 16:15:48 CDT 2006
On Apr 28, 2006, at 3:54 PM, Triche Osborne wrote:
> Okay, I'm going to ask a question which I'm sure has a reasonable
> answer, but I can't help being curious: Why hasn't the source been
> impregnated with a delimiter other than a space? This would make it
> a simple matter of exploding (PHP) or splitting (JS) the string,
> which avoids the drag that regex imposes on optimization in PHP.
When I did this, the answer to that question was that the source was
a person, and people type searches with spaces between words. What I
did was just break it up by space, and then merge adjacent parts
until each one had an even number of quote marks. I think it would
take a very complicated RegEx to do this because you'd have to figure
out which quotes went together, and then you have to figure out what
to do when there's an odd number of quotes.
Peace,
Scott
More information about the Javascript
mailing list