Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: regex escaping forward slash in regex

by JadeNB (Chaplain)
on Dec 10, 2009 at 01:19 UTC ( #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 (Pope) 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?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2021-05-14 22:11 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (150 votes). Check out past polls.