Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Regex to replace a particular part of content

by shmem (Chancellor)
on Jun 22, 2006 at 11:26 UTC ( [id://556891]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    blah blah blah     #line \
    blah blah blah     #line - paragraph
    ...
    blah blah blah     #line \
    blah blah blah     #line - paragraph
    blah blah blah     #line /
    
  2. or download this
    #!/usr/bin/perl
    $file = shift;
    ...
    s|<list>(.*?)</list>|"<list>".join("\n",map{"<item>$_</item>"}
        split"\n",$1)."</list>"|ges;
    print;
    
  3. or download this
    perl -p00 -e 's|<list>(.*?)</list>|"<list>".join("\n",map{"<item>$_</i
    +tem>"}split"\n",$1)."</list>"|ges;' textfile
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://556891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found