[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Sat, 13 Aug 2005 19:28:54 -0400 (EDT) -->
- <!--x-from-r13: wbr ng znqrjryy.pbz (Xbr Egrryr) -->
- <!--x-message-id: Pine.LNX.3.96.1050813175226.6638A-[email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Yet another regex question -->
- <li><em>date</em>: Sat, 13 Aug 2005 19:28:54 -0400 (EDT)</li>
- <li><em>from</em>: joe at madewell.com (Joe Steele)</li>
- <li><em>in-reply-to</em>: <<a href="msg00156.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] Yet another regex question</li>
The pattern you are using below is equivalent to '[^%].XMI001|\SXMI001',
requiring that your text match either:
'[^%].XMI001' (requiring at least two characters before the alarm), or
'\SXMI001' (requiring at least one non-whitespace character before the
alarm).
--Joe
On Sat, 13 Aug 2005, Christopher Fowler wrote:
> It only works when there are 2 spaces in front of the alarm
>
> [cfowler at shuttle ~]$ ./regex.pl '([^%].|\S)XMI001' 'XMI001'
> No
> [cfowler at shuttle ~]$ ./regex.pl '([^%].|\S)XMI001' ' XMI001'
> Yes
>
>
> Maybe I'm doing it wrong?[cfowler at shuttle ~]$ cat regex.pl
> #!/usr/bin/perl
> die "regex.pl <regex> <test string>\n" unless $ARGV[0] and $ARGV[1];
> my $regex = $ARGV[0];
> if($ARGV[1] =~ m/$regex/) {
> print "Yes\n";
> } else {
> print "No\n";
> }
>
>
> The only reason I'm using perl this way is to test the regex.
>
</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00156" href="msg00156.html">[ale] Yet another regex question</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00156.html">[ale] Yet another regex question</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00158.html">[ale] multiple monitors - different desktops</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00156.html">[ale] Yet another regex question</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00142.html">[ale] Yet another regex question</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00157"><strong>Date</strong></a></li>
<li><a href="threads.html#00157"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>