CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Can I do an if-then-else regex mixing match and substitution?: Edit Log



poly4life
Novice

Mar 25, 2011, 1:46 PM


Views: 5555
Can I do an if-then-else regex mixing match and substitution?

Hello,

Is it possible to do mix match and substitution regex's inside an if-then-else regex conditional?

example:

(?(match)s/pattern/replacement/g)

It's not even pseudo-code, just a concept of what I think it might look like, but is this possible?

FYI, I'm searching..matching in a text file. If the text file matches the pattern, then do a search..replace in another area of the text file.

Thank you.


(This post was edited by poly4life on Mar 25, 2011, 1:51 PM)


Edit Log:
Post edited by poly4life (Novice) on Mar 25, 2011, 1:51 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives