in reply to Re: problem with optional capture group
in thread problem with optional capture group
The problem with using the + quantifier is that the entire regex will not match a line that has an opening <div tag but no closing </div tag on the same line. For example, your modification will not match the following:
my $line = "<div id=\"roguebin-response-35911\" class=\"bin-response\" +>";
I was hoping to write a single regex that will handle both cases, i.e. an opening <div tag with a closing </div tag on the same line, and an opening <div tag with no closing </div tag on the same line. I understand a built in parser would make this task easier, but I would still like to understand how to write a single regex that would capture both of these cases.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: problem with optional capture group
by AnomalousMonk (Archbishop) on Dec 22, 2020 at 22:57 UTC | |
by Special_K (Pilgrim) on Dec 23, 2020 at 16:31 UTC | |
by AnomalousMonk (Archbishop) on Dec 23, 2020 at 20:54 UTC |