Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Dealing with Regexes for a specific replacement pattern

by jweed (Chaplain)
on Feb 21, 2004 at 04:57 UTC ( [id://330768]=note: print w/replies, xml ) Need Help??


in reply to Dealing with Regexes for a specific replacement pattern

What you need are backreferences. Try:
s/338C(\d{3}C\d{3}C\S{8})/338C$1C/g



Code is (almost) always untested.
http://www.justicepoetic.net/

Replies are listed 'Best First'.
Re: Dealing with Regexes for a specific replacement pattern
by Abigail-II (Bishop) on Feb 21, 2004 at 11:19 UTC
    Or even simpler:
    s/(338C\d{3}C\d{3}C\S{8})/$1C/g

    Abigail

      Thanks much! Appreciate it!
      /Gridlock a.k.a. Debashis "Codito Ergo Sum"

Log In?
Username:
Password:

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

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

    No recent polls found