[Chicago-talk] Regular expression question

Michael Potter michael at potter.name
Fri May 1 20:12:08 PDT 2009


On Fri, May 1, 2009 at 9:29 PM, Andrew Rodland <arodland at comcast.net> wrote:

> On Friday 01 May 2009 08:56:21 pm Jay Strauss wrote:
> > On Fri, May 1, 2009 at 6:17 PM, Joshua McAdams <joshua.mcadams at gmail.com
> >
> wrote:
> > > Could you get by with s/\bEft\b/EFT/
> >
> > Would you please explain to the slow ones in the class (me) why/how
> > the solution is not not equal to the problem?
>
> \b matches the boundary between a \w word char and a \W nonword char (or
> start/end of string). So that pattern would match if "Eft" is bounded by
> any
> non-word chars, for instance "Newt-Eft-Salamander" will become "Newt-EFT-
> Salamander" under that substitution because "-" is a nonword char, so \b
> will
> match between "-" and "E" and between "t" and "-".
>
> Andrew
>
>
Thanks Andrew, I think that is the winner.  I will probably run a before and
after on the data to see if there are any surprises.

-- 
Michael Potter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20090501/74cf2780/attachment-0001.html>


More information about the Chicago-talk mailing list