regex help

JT Moree moreejt at pcxperience.com
Thu Dec 20 16:58:42 MST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matrix Mole wrote:
> {some text} /home/matrixm {more text} /home/matrixm {even more text}
> 
> and I want to add onto the path of the second path so that instead it
> looks like this:
> 
> {some text} /home/matrixm {more text} /home/matrixm/tmp {even more text}
> 
> I know that a switch command can do it
> (s:/home/matrixm:/home/matrixm/tmp:) but I don't know how to force regex
> to only work on the second occurrence of the pattern match.

in perl it would be done like this

s|^(.*)/home/matrixm(.*)/home/matrixm(.*)$|$1/home/matrixm$2/home/matrixm$3|


- --
JT Morée
PC Xperience, Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHawGy1JwGi/ukQqERApCaAKC6yoW1HMd4yt4kfXtIKSISiGCJOwCg8th6
BYaREr9jhqbEiEkKaZIgcyk=
=kcUd
-----END PGP SIGNATURE-----

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.



More information about the PLUG-discuss mailing list