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

[no subject]



> On Sat, Aug 13, 2005 at 05:53:16AM -0400, Christopher Fowler wrote:
> > On Sat, 2005-08-13 at 02:48 -0400, Jim Popovitch wrote:
> [snip]
> > > So, a regmatch of "[^ ]XMI001" would match "XMI001" and "zXMI001" but
> > > not " XMI001" since the brackets contain a negated space (i.e. no space
> > > before XMI001) 
> > 
> > I think the problem with that is that it requires something to be before
> > the X.  Something has to be there but no space.  I'm using perl to test
> > the ideas.
> 
> Try "[^ ]?XMI001".  That should match the string "XMI001" optionally
> preceded by any character that is not a space.  If you want to match 0
> or more non-spaces, use "[^ ]*XMI001".

But the string "   XMI001" *is* an instance of "XMI001" preceded by
zero non-space characters (and those zero non-spaces are preceded
by some spaces), so would match both of your expressions.

This definitely requires negative lookbehind, or else a multi-step
filter (get the lines containing "XMI001", then discard the ones
containing " XMI001"). "grep XMI001 [file] | grep -v ' XMI001'"
should do it. Except I think Chris said that the input is NOT
line-oriented, which means that no line-oriented filter is going
to be able to do the right thing.

-- Joe Knapka


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00290" href="msg00290.html">[ale] Yet another regex question</a></strong>
<ul><li><em>From:</em> jasonday at worldnet.att.net (Jason Day)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00130" href="msg00130.html">[ale] Yet another regex question</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00131" href="msg00131.html">[ale] Yet another regex question</a></strong>
<ul><li><em>From:</em> jimpop at yahoo.com (Jim Popovitch)</li></ul></li>
<li><strong><a name="00132" href="msg00132.html">[ale] Yet another regex question</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00133" href="msg00133.html">[ale] Yet another regex question</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00136" href="msg00136.html">[ale] Yet another regex question</a></strong>
<ul><li><em>From:</em> jimpop at yahoo.com (Jim Popovitch)</li></ul></li>
<li><strong><a name="00138" href="msg00138.html">[ale] Yet another regex question</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Christopher Fowler)</li></ul></li>
<li><strong><a name="00206" href="msg00206.html">[ale] Yet another regex question</a></strong>
<ul><li><em>From:</em> jasonday at worldnet.att.net (Jason Day)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00280.html">[ale] new box crashes when nmapped</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00281.html">[ale] Vonage redux</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00206.html">[ale] Yet another regex question</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00290.html">[ale] Yet another regex question</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00279"><strong>Date</strong></a></li>
<li><a href="threads.html#00279"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>