RE: How to avoid this greedy match?
- From: najay@xxxxxxxxxxxxx (Ajay Nagrale)
- Date: Tue, 29 Jan 2008 12:01:35 +0530
Hi,
I don't think '<' or '>' are meta characters in regular expression match.
"<>" is reserved for opening the files given at command line argument.
If we use "[^<]* and [^>]*", regular expression will fail to match pattern like "<script>xxx</script>zzz<script>>>222<></script>" [Pattern having angular brackets beside 222.Aside from that, consider using [^<]* and [^>]* in place of .*
As we don't know what can precede or succeed '222', it's better we don't give any restriction in the regular expression.
~Ajay
-----Original Message-----
From: anexpert@xxxxxxxxx [mailto:anexpert@xxxxxxxxx]On Behalf Of yitzle
Sent: Tuesday, January 29, 2008 11:53 AM
To: Nagrale, Ajay
Cc: News Howardz; beginners@xxxxxxxx
Subject: Re: How to avoid this greedy match?
I'm not sure how it works, but I think <> or \<\> is a RegEx reserved
character for word matching.
Aside from that, consider using [^<]* and [^>]* in place of .*
.
- References:
- Re: How to avoid this greedy match?
- From: Yitzle
- Re: How to avoid this greedy match?
- Prev by Date: Re: Clear a hash
- Next by Date: Re: print records that match regexp
- Previous by thread: Re: How to avoid this greedy match?
- Next by thread: Re: How to avoid this greedy match?
- Index(es):
Relevant Pages
|