As an example I have this string: aaa bbb “aaa bbb ccc” bbb “ddd”
I want to match bbb, but only if it’s not inside quotation marks using regex.
Anyone have an idea?
UPDATE
I suppose I should have been more specific, I’ll amend my example:
Say I have an html tag, I wish to grab an attribute and its value:
<input type="text" id="textbox" myattr="myvalue" name="myattr test" />
I need to match the word’s myattr and myvalue, but ONLY when myattr is not surrounded by quotes and when myvalue is definitely myattr’s value.
Why can’t you just use
attr('myattr')on yourinputelement?See an example jsfiddle;
Also, I suggest looking into the following:
Why reinvent the wheel when others have code ready for you to use?