Friday, 6 September 2013

Which Regex to parse search hints

Which Regex to parse search hints

My regex fu is terrible. I want to build a smart search where I can give
hints to the search engine on what to search on which property.
Something like this:
Search input: location: London
-> ["London"]
Search input: location: London, New York
-> ["London", "New York"]
Search input: location: London tags: Bar
-> ["London"]
-> ["Bar"]
Search input: location: London, New York tags: Bar, Club
-> ["London", "New York"]
-> ["Bar", "Club"]
I wonder how should the regex look like to parse the user input like that?

No comments:

Post a Comment