I need to match words of certain criteria, but only if they are within quotes*. I'd wish to do this via Regex.
I think there's a "jQuery plugin for that". Google for jQuery basic arithmetic plugin.
Let's say I have the above text as the subject of a Regex search, and I'd wish to find the word "plugin", if it is inside quotes. I do not need to match the second "plugin" word at the end of the sentence, since it's not within quotes, but (edit) I do need to match multiple occurrences of "plugin", were they enclosed by quotes (even if there are multiple occurrences inside a single quotation block).
With a working expression, the following words (highlighted with bold text) should be matched:
I think there's a "jQuery plugin for that". Google for jQuery basic arithmetic plugin.
I have a theoretical solution that would use a positive lookahead to determine if there is an even or odd number of quotes, and match the word if that number is odd.
What regular expression should I use to accomplish this?
*double quotes only
I use this expression to match words that are not surrounded with quotes, following a very similar logic:
\bplugin\b(?=[^"]*(?:"[^"]*"[^"]*)*$)