Sunday, 15 March 2015

javascript - Regular expression keyword filtering -


I am trying to create a search using regular expression which uses special words to special Filters the search query. For example, if I have a question: artist rolling path, track the stupid girl track in black , it will remove the albums given by the Rolling Stones and will be a stupid girl in the tracks and It will paint in black color. Ideally (after a few years of processing) I send data to the server like this: {Artist: ['Rolling Stone'], tracks: ['stupid girl', 'cut color']} < / Code>.

I have a basic regex that matches the keyword (artist / track) and is the first word after the keyword (rolling / stupid / paint), however if I use it with spaces and words I match, so just matches the whole string.

This is currently the rezux present: (artist | track) \ s ([\ w] +) . I am feeling that I need to use stop words or some things to create a boundary between phrases, but I am not feeling well with the creation of regex. Any help will be very much appreciated.

  (artist | track). *? (? = | Artist | Track | $)  

Try this code


No comments:

Post a Comment