$ perl -e ' $minuend = 'red'; $subtra = 'Hellored'; $res = $subtra =~ s/$minuend//; print $minuend, "\t", $subtra, "\t", $res;' red Hello 1
$res flags success/fail. If you would like $subtra to remain unchanged assign $dif = $subtra then $res = $dif =~ s/$minuend//; HTH "Pavle Lukic" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Alex > > This is one way to resolve the issue: > $x = substr($a,0,index($a,$b)).substr($a,index($a,$b)+length($b)); > > I would like to see a solution in terms of regex. > > Cheers > > Pavle > > ----- Original Message ----- > From: "Alex Demmler" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, January 06, 2003 3:06 PM > Subject: How to substract words > > > > Hi folks! > > > > I have a problem with pattern matching. > > I want do find the difference between two words. I have tried, but donot > get > > it work. Any tips? > > > > Example: > > > > 1. Word = helloRed > > 2. Word = hello > > ------------------- > > Result = Red > > > > Thanks Alex > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]