Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Problems with non-greedy quantifiers

Closed / Fixed217915ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:45:55
OriginalBugID: 2866 Bug
Version: 8.2
SubmitDate: '1999-09-23'
LastModified: '2000-01-27'
Severity: LOW
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 4001
OS: Windows NT
OSVersion: 4.0 SP5
Machine: X86
FixedDate: '2000-10-25'
ClosedDate: '2000-01-27'


Name:
Ingemar Hansson

Comments:
Perl handles this expression as expected  :-(

ReproducibleScript:
# This regular expression should extract a piece of text from a
HTML-coded line of text
regexp {^<TR><TD .*?><FONT .*?>(?:<A HREF.*?>)?(.*?)<} $line match result

The lines may look like this (They're very long. I'll only show the
beginning)
<TR><TD NOWRAP ALIGN=LEFT><FONT SIZE=1 FACE=Arial COLOR=#FF0000><A
HREF="http://some.url">Wanted text 1</A></FO
<TR><TD NOWRAP ALIGN=LEFT><FONT SIZE=1 FACE=Arial COLOR=#FF0000>Wanted
text 2</FO
<TR><TD NOWRAP ALIGN=LEFT><FONT SIZE=1 FACE=Arial>Wanted text 3</FO
<TR><TD NOWRAP ALIGN=LEFT><FONT SIZE=1 FACE=Arial><A
HREF="http://some.other.url">Wanted text 4</A></FO

ObservedBehavior:
regexp cannot handle the expression "(?:<A HREF.*?>)?" correctly. regexp
returns "<TR><TD NOWRAP ALIGN=LEFT><FONT SIZE=1 FACE=Arial
COLOR=#FF0000><" in match and nothing in result.

DesiredBehavior:
obvious
welch Closed ticket [217915ffff]. [History diff]2000-10-26 08:09:12
Log in (anonymous is fine) to add a comment.