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

[ale] Yet another regex question

Jason Day <jasonday at worldnet.att.net> writes:

> On Thu, Aug 18, 2005 at 02:40:35PM -0600, Joe Knapka wrote:
> > Jason Day <jasonday at worldnet.att.net> writes:
> > > 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.
> Damn, you're absolutely right.
> What about "([^ ]|^)XMI001"?  That should match against a non-space OR
> the beginning of line (or string) followed by the XMI001.  I know Chris
> said the regex engine is not seeing the lines, but I'm curious if this
> would work.

Yes, it should, I think. I'd like to see an actual sample of the data
Chris is trying to process.

-- Joe