perl regex escape characters

后端 未结 2 784
情话喂你
情话喂你 2020-12-21 02:11

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/RETeste

2条回答
  •  天命终不由人
    2020-12-21 02:20

    You can choose use ! instead of / to surround your regular expression so that you don't have to escape the /.

    m!//home/dev/((.*?)/[^/]+).*#!
    

    should work. Here's it in action: http://ideone.com/TDrBG

提交回复
热议问题