I'm implementing a search in my website, and would like to support searching for exact phrases. I want to end up with an array of terms to search for; here are some examples:
"foobar \"your mom\" bar foo"
=> ["foobar", "your mom", "bar", "foo"]
"ruby rails'test course''test lesson'asdf"
=> ["ruby", "rails", "test course", "test lesson", "asdf"]
Notice that there doesn't necessarily have to be a space before or after the quotes.
I'm not well versed in regular expressions, and it seems unnecessary to try to split it repeatedly on single characters. Can anybody help me out? Thanks.'