Im building a query to submit to a search, one of the input fields is a filter for "OR". I need to replace whitespace with +OR+..only if the whitespace occurs outside of quoted text. So this is the logic:
"Happy Days"+OR+"Love Boat"
I have working code that will do that here:
var filter2=$('[name=filter2]').val();
var str2 = jQuery.trim(filter2);
var filter2d = str2.replace(/" "/g, "\"+OR+\"");
This only works if the text has quotes..I would like to be able to do this as well:
fonzy+OR+"Happy Days"+OR+"Love Boat"
Any help is appreciated