[SLUG] Quick question
Stephen O'Neill
squid at thefloatingfrog.co.uk
Tue Jul 15 07:18:54 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Al Girling wrote:
> Of course, you could use this to your advantage by writing your regex
> as:
>
> sed -i 's/KoolTrax/&\™/g' *.php*
>
> because the Ampersand captures the search expression and reuses it as
> part of the replacement.
Ahhh... *scribbles furiously*.
> Something else to note is your search expression isn't restricted to
> KoolTrax. It seems unlikely in this instance, but if your search was
> for say, quick. As the expression is currently, it would match quickly,
> quickest etc. So you would need to use:
>
> sed -i 's/\<KoolTrax\>/&\™/g' *.php*
In that instance I would tend to use the word boundary character class -
is '\<word\>' exactly equivalent to '\bword\b'?
sed -i 's/\bKoolTrax\b/&\™/g' *.php*
- --
Stephen O'Neill
w: http://www.thefloatingfrog.co.uk/
e: squid at thefloatingfrog.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFIfEFNJ+Auntu1v4QRAk54AJ99dE8AC/RvdoXieweHKE3w6X/kQgCgmcAZ
CLsP/iw9PJh5PgXU28xcDoM=
=9m3u
-----END PGP SIGNATURE-----
More information about the Scarborough
mailing list