Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Regex to replace a particular part of content

by shmem (Chancellor)
on Jun 22, 2006 at 11:26 UTC ( #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? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-08-13 09:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?