[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



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>