Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: get the string upto word containing tag block

by prasadbabu (Prior)
on Aug 17, 2010 at 07:21 UTC ( #855414=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://855414]
help
Chatterbox?
[choroba]: It's just troll feeding.
[beech]: of course the magic word that explains everything :p
[erix]: they should lean to gnash their teeth a bit instead of writing more ^Re:NN-nodes :)
[erix]: *learn

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2017-01-17 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (159 votes). Check out past polls.