[ale] Yet another regex question

Jason Day jasonday at worldnet.att.net
Fri Aug 19 10:30:21 EDT 2005


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.

Jason
-- 
Jason Day                                       jasonday at
http://jasonday.home.att.net                    worldnet dot att dot net
 
"Of course I'm paranoid, everyone is trying to kill me."
    -- Weyoun-6, Star Trek: Deep Space 9



More information about the Ale mailing list