perl regex escape characters
        Posted  
        
            by 
                freshWoWer
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by freshWoWer
        
        
        
        Published on 2010-12-29T00:08:44Z
        Indexed on 
            2010/12/29
            10:54 UTC
        
        
        Read the original article
        Hit count: 557
        
I have heard perl is a good language at doing regex but i am a bit confused at the characters that requires escaping
I tested the code on http://regexlib.com/RETester.aspx and got the result I want
//home/dev/abc/code/hello/world.cpp#1
//home/dev/((.*?)/[^/]+).*#
Match   $1  $2
//home/dev/abc/code/hello/world.cpp#    abc/code    abc
However, I am not quite sure how do i translate this to perl code
I tried,
\/\/home\/dev\/\(\(\.\*\?\)\/\[\^\/\]\+\)\.\*\#
and
\/\/home\/dev\/((.*?)\/[^\/]+).*\#
and both failed
Don't you think the escaping makes the regex very unreadable? Am i using something wrong?
© Stack Overflow or respective owner