Article View: news.software.readers
Article #131191Re: [ Dialog ] Regex .
From: Norbert Schmidt
Date: Thu, 21 Aug 2003 04:36
Date: Thu, 21 Aug 2003 04:36
22 lines
2311 bytes
2311 bytes
Hello Jeff, > Why is the " [^<] " needed ? > Wouldn't the " > " be found before the next " < " ? RegEx is "greedy": It always tries to match as much as possible. So " <.*>" would match the /whole/ string of " <first> <and> <last>"! Which is excactly what you don't want in this case. ;-) You can modify the behavior by appending a "?" to the count specifier like this: " <.+?>". Then RegEx uses the least possible amount. That would have usually the desired effect, except that it also matches invalid stuff like " <oops> <something <fishy>" would be matches as " <oops>" and "<something <fishy>" while the original expression balks and only catches " <fishy>". Regards, Norbert -- Please post your replies to the news group only. Reply-To is only temporarily valid and aggressively filtered. For questions concerning my address please read <http://www.privacy.net>.
Technical Details
Message-ID:
<ix9ffup7fuqu$.dlg@N.Schmidt-news-xxxx.gmx.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!p508b089a.dip0.t-ipconnect.DE!not-for-mailReferences:
<Xns93DC5073CBBE3Relf@130.133.1.4> <px01supfmi9b$.qgfffz4oyefq.dlg@40tude.net> <Xns93DC7FE3BDF59Relf@130.133.1.4> <qsq2dcaqx5ht$.17f57t5i0uevk.dlg@40tude.net> <1o6bku3w3c3yi$.dlg@news.lillathedog.net> <Xns93DCD3155A8F6Relf@130.133.1.4> <1lbf6tzprjvgk.dlg@news.lillathedog.net> <Xns93DD9253CDDDERelf@130.133.1.4> <1b4157zhf8iop.dlg@news.lillathedog.net> <m0ju2nkbfen2.dlg@Relf.COM> <8g4kluyuytmf$.dlg@gandalf.my-fqdn.de> <Xns93DDB37E18C86Relf@130.133.1.4> <1bzdd0h0krdom$.dlg@Jeff.Relf>Show Full Headers
Complete Article Headers
Message-ID: <ix9ffup7fuqu$.dlg@N.Schmidt-news-xxxx.gmx.de> Subject: Re: [ Dialog ] Regex . Date: Thu, 21 Aug 2003 06:36:51 +0200 From: Norbert Schmidt <me@privacy.net> References: <Xns93DC5073CBBE3Relf@130.133.1.4> <px01supfmi9b$.qgfffz4oyefq.dlg@40tude.net> <Xns93DC7FE3BDF59Relf@130.133.1.4> <qsq2dcaqx5ht$.17f57t5i0uevk.dlg@40tude.net> <1o6bku3w3c3yi$.dlg@news.lillathedog.net> <Xns93DCD3155A8F6Relf@130.133.1.4> <1lbf6tzprjvgk.dlg@news.lillathedog.net> <Xns93DD9253CDDDERelf@130.133.1.4> <1b4157zhf8iop.dlg@news.lillathedog.net> <m0ju2nkbfen2.dlg@Relf.COM> <8g4kluyuytmf$.dlg@gandalf.my-fqdn.de> <Xns93DDB37E18C86Relf@130.133.1.4> <1bzdd0h0krdom$.dlg@Jeff.Relf> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!p508b089a.dip0.t-ipconnect.DE!not-for-mail Newsgroups: news.software.readers Lines: 21 Reply-To: N.Schmidt-news-0306@gmx.de NNTP-Posting-Host: p508b089a.dip0.t-ipconnect.de (80.139.8.154) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1061440608 4504596 80.139.8.154 (16 [188787]) User-Agent: 40tude_Dialog/2.0.5.1