Dear All,
This is a sample code, I hope it would explain my problem.
I want to extract some text from string based on some criteria.
1) My definition
2) Words
3) Non-Words
My code goes as follows
===================================================================
$ref=" <bold> This a test <\/bold><med >
";
my $srch=qr(<bold>\ |<\/bold>|This\ a\ test)x;
while ($ref =~ s/((?:$srch)|\w+|\W+)//s)
{
my ($word) = ($1);
print "#=>: $word#\n";
}
===================================================================
I get output like this, Since \W+ is more generic than $srch it captures \W+
#=>: <#
#=>: bold#
#=>: > #
#=>: This a test#
#=>: </#
#=>: bold#
#=>: ><#
#=>: med#
#=>: >
#
But I want output in the following way.
#=>: #
#=>:<bold> #
#=>: This a test#
#=>: </bold>#
#=>: <#
#=>: med#
#=>: >
#
Regards,
Sandeep Deshpande
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs