http://qs321.pair.com?node_id=855414


in reply to get the string upto word containing tag block

Hi Shanmugam,

If I understood your quesion well, this dirty code will give your output. BUT TIMTOWTDI.

$str = '<w:pict>4</w:pict> </w:r></w:p><w:tbl><w:tblPr> <w:t> </w:t> <w:t>Figure 2.</w:t> <w:t>Figure 3.</w:t> <w:pict>5</w:pict>'; $str = qr{$str}; $str =~ m|^((((?![^\s]+<\/w:t>).)+).+?(<\/w:t>))|s; $new_str = $1; $new_str =~ s|(<w:t>\w(((?!</w:t>).)+)</w:t>).+$|$1|s; print $new_str; output: ======= <w:pict>4</w:pict> </w:r></w:p><w:tbl><w:tblPr> <w:t> </w:t> <w:t>Figure 2.</w:t>

Prasad