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

Re: replace at the begining

by ashish.kvarma (Monk)
on Aug 20, 2009 at 12:37 UTC ( [id://790076]=note: print w/replies, xml ) Need Help??


in reply to replace at the begining

Another simple solution could be (without using look-behind)
s/<?(p\s+class=)/<$1/;
Regards,
Ashish

Replies are listed 'Best First'.
Re^2: replace at the begining
by Anonymous Monk on Aug 20, 2009 at 15:37 UTC
    #!/usr/bin/perl while(<DATA>){ s/(?<!<)p\sclass=/<p class=/; print $_; } __DATA__ <p class="Hi">Hello <p class="new">How r u
    The above output should look like
    <p class="Hi"\>Hello <p class="new"\>How r u

Log In?
Username:
Password:

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

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

    No recent polls found