Cap'n Steve has asked for the wisdom of the Perl Monks concerning the following question:
What I'm wondering now is if I should allow users to escape quotes in the attribute. I know this is more trouble than it's worth, but I'm curious. How would I go about ignoring the quotation marks preceded by a backslash? I've tried a negative lookbehind within the conditional, but it didn't work./name=(")? # "name" attribute followed by optional quote ([^(?(1)"|\s\])]+) # if the quotation mark was present, match until an +other one, otherwise stop at whitespace or a bracket (?(1)") # match end quote, if applicable /xi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular expression help: Taking HTML-like attributes with optional quotes
by tlm (Prior) on Jun 28, 2005 at 10:24 UTC | |
|
Re: Regular expression help: Taking HTML-like attributes with optional quotes
by rlucas (Scribe) on Jun 28, 2005 at 07:08 UTC |