I need a Perl regular expression to select content only if the content is missing either the beginning quote or ending quote. The beginning quote will always be preceded by an equal symbol =. The ending quote can be followed by a space, more text or carriage return. In one given line there can be many attributes (quote pairs) to check.
I tried (?<!")(.*?)" but that was a disaster. I thought maybe I could just do a simple regular expression find the equal symbol, look at next character and check if it's a quote followed by text and an end quote. But if there is no quote on the beginning or end of the text, then add it.
Things to note the text in between the quotes will always be character data. There will be no symbols or spaces.
I tried this regular expression which worked in regex101, but UES doesn't register it.
You can see the regex works at this website. https://regex101.com/r/2qvpLr/1
Thank you for the help. Max
I tried (?<!")(.*?)" but that was a disaster. I thought maybe I could just do a simple regular expression find the equal symbol, look at next character and check if it's a quote followed by text and an end quote. But if there is no quote on the beginning or end of the text, then add it.
Things to note the text in between the quotes will always be character data. There will be no symbols or spaces.
Code: Select all
<table pgwide="0" id="dvr_config_firmware>
<title>DFR Firmware</title>
<tgroup cols="2">
<colspec colname="col1>
<colspec colname="col2">
Code: Select all
/=(?|(")([^"<>\s]*)()(?=[\s>]|\/>)|(?!")()([^"<>\s]*)("))/
Thank you for the help. Max