Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: regex escaping forward slash in regex

by JadeNB (Chaplain)
on Dec 10, 2009 at 01:19 UTC ( [id://812073]=note: print w/replies, xml ) Need Help??


in reply to regex escaping forward slash in regex

‘Dumb’ search-and-replaces (and I mean that as a comment on the code, not on you!) always strike fear in my heart; if we can't even parse such a rigid language as XML with regexes (which we can't, right? Or at least no sane person would?), how can we expect correctly to parse the rich grammar of a programming language? I always think of clbuttic.

If this were my job, the first thing I'd do would be to look at some means of getting at the internal, not textual, representation of a PHP program. The first result for PHP + AST is php-ast; I'm not sure if it does what you want, but you might be able to fold, spindle, and mutilate it, or else just look further down in the results.

  • Comment on Re: regex escaping forward slash in regex

Replies are listed 'Best First'.
Re^2: regex escaping forward slash in regex
by ikegami (Patriarch) on Dec 10, 2009 at 02:57 UTC

    Dumb search-and-replaces always strike fear in my heart

    I do dumb search-and-replaces a hundred times a day, mostly with my editor's search and replace box. There's nothing wrong with it if the process is supervised.

    In the OP's case, he can use a visual diff tool — I love Beyond Compare — to compare the pre- and post-change versions of his files and fix the mistakes.

    And then he has to do a manual search to change the ones the tool didn't catch.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-19 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found