I need to get the values inside a string from an input form to use in a search, i will some examples:
Example 1: name="Peter Nash","Costa", should return Peter Nash and Costa.
Example 2: name='Peter Nash',"Costa", should return: Peter Nash and Costa.
Example 3: name="Peter Nash", should return: Peter Nash.
Example 4: name=Peter,"Costa", should return: Peter and Costa.
Example 5: name=Peter,Costa, should return: Peter and Costa.
Example 6: name=Peter, should return: Peter.
The name is a variable, it can change.
Right now i'm using something like new RegExp(string_var + "\:([^ ]+)", "").exec(input);, but doesn't work with quotes or commas.