Operating System - HP-UX
1830899 Members
3421 Online
110017 Solutions
New Discussion

Re: perl substitution question

 
SOLVED
Go to solution
Mike_Ca Li
Regular Advisor

perl substitution question

How to replace
"Test(23)" with "Test(23)
"
"Test(1234)" with "Test(1234)
"
"Test(any number of digits)" with "Test(anynumber of digits)
"
Thanks.
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: perl substitution question

Hi Mike:

# echo "Test(123)"|perl -wlpe 's/Test\((\d+)\)/Test\($1\)
/'

Regards!

...JRF...
Mike_Ca Li
Regular Advisor

Re: perl substitution question

Works great! Thanks
Paul F. Carlson
Valued Contributor

Re: perl substitution question

$st="Test(123479)";

$st =~ s/Test\((\d+)\)/Test\($1\)
/g;
Link down -- cable problem?