Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular expression find and replace

Status
Not open for further replies.

mufka

ISP
Dec 18, 2000
587
US
Is there a way to use a regular expression find and replace to locate a string and trim out unwanted characters. For example I want to search for (--1234--) and replace with (1234).
 
What if 1234 is variable? Could be 1256, 8127, etc.
 
Code:
s/\-\-(\d+)\-\-/$1/g;

OK, next what-if. [wink]




------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top