Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: search and replace desired portion from a line

by thanos1983 (Parson)
on May 29, 2019 at 08:42 UTC ( [id://11100688]=note: print w/replies, xml ) Need Help??


in reply to search and replace desired portion from a line

Hello syedasadali95,

I suppose you want to match any single integer from 0-9 after addr:0x*? If this is the case why not simply like:

$line1 =~ s/addr:0x[0-9]/addr:$address/;

Also there is no need to escape semicolon character. :)

Update: Fellow Monk AnomalousMonk has a point. This is the more correct solution $line1 =~ s/addr:0x[[:xdigit:]]+/addr:$address/;. Since this a hex value and not just a digit.

Hope this helps, BR.

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re^2: search and replace desired portion from a line
by syedasadali95 (Acolyte) on May 30, 2019 at 07:03 UTC
    Thankyou

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-03-28 11:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found