Forum Moderators: coopster & phranque

Message Too Old, No Replies

really easy perl question probably

substituting characters between two others

         

basenotes

3:43 pm on Nov 11, 2003 (gmt 0)

10+ Year Member



I'm sorry if this is really stoopid question, but I hope someonce can help.

I know that when substituting in perl

s/a.b/foo/g

will (i think) change all occurences of 'asb', 'avb', 'ahb', 'a[any character]b' with 'foo'.

how can I get it so that it will replace, more than a single character, so that as well as replacing 'asb'. 'ahb' etc, it will also replace 'awwwwwb', 'acccccccccccb', aertyub' etc.

Please ask if this makes no sense!

coopster

3:48 pm on Nov 11, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, basenotes!

s/a.*b/foo/g

basenotes

3:55 pm on Nov 11, 2003 (gmt 0)

10+ Year Member



Thanks coopster! and very fast!

Cheers!