Re: Help with substitution

2005-05-12 Thread perlocean
- Original Message - From: "Moon, John" <[EMAIL PROTECTED]> To: "'Tham, Philip'" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, May 10, 2005 4:55 PM Subject: RE: Help with substitution To: 'Tham, Philip' Subject: RE: Help with substitutio

RE: Help with substitution

2005-05-10 Thread David Aldridge
This worked for me. Don't forget the 'greedy' regex: s/^.*?(abc)//; -Original Message- From: Tham, Philip [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 10, 2005 3:59 PM To: beginners@perl.org Subject: Help with substitution Hi I have a string which reoccuring patterns 1abc2abc3abc4a

RE: Help with substitution

2005-05-10 Thread Moon, John
To: 'Tham, Philip' Subject: RE: Help with substitution Subject: Help with substitution Hi I have a string which reoccuring patterns 1abc2abc3abc4abc567 How do I remove everything before the 1st occrence of abc to get the result 2abc3abc4abc567 s/^.*abc// Gives me 567 Thanks

Re: help with substitution

2002-12-11 Thread Rob Dixon
Hi Erik You might like this! $givenword =~ s/[a-z]/substr $word, pos $givenword, 1/egi; Cheers, R - Original Message - From: "Erik Browaldh" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 4:01 PM Subject: Re: help with subst

Re: help with substitution

2002-12-11 Thread Erik Browaldh
Hi! no, its still not changing the letters (but thanks Rob).. I have a string: $givenword="YY-" and another string (the original) $word="not" now I want $givenword to look like this: $givenword="no-" ? thanks in advanced! Erik Rob Dixon wrote: Hello Erik It's not clear exactly what you

Re: help with substitution

2002-12-11 Thread Rob Dixon
Hello Erik It's not clear exactly what you want, but something like this should do the job: for (my $i = 0; $i < length $word; ++$i) { substr ($word, $i, 1) = '-' unless substr ($givenword, $i, 1) eq 'X'; } HTH, Rob - Original Message - From: "Erik Browaldh" <[EMA