Try this
use strict; my $input=' This is sample <This is sample text> This is sample <This is sample text <a>this is sample text</a> sam +ple text > '; my @arr=$input=~m#<[^<>]+(?:<a>.+?</a>[^<>]*)?>#g; local $"="\n"; print "\n@arr";
Output
<This is sample text> <This is sample text <a>this is sample text</a> sample text >
In reply to Re: encode HTML entities with a regexp
by gopalr
in thread encode HTML entities with a regexp
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |