Slashes and hashes in Perl and metacharacters

前端 未结 6 1040
旧巷少年郎
旧巷少年郎 2020-12-22 01:32

Thanks for the previous assistance everyone!. I have a query regarding RegExp in Perl

My issue is..

I know, when matching you can write m// or // or ## (mus

6条回答
  •  甜味超标
    2020-12-22 01:52

    The regex match-operator allows to define i a custom non-whitespace-character as seperator.

    In your first example the '#' is used as seperator. So in this regex you don't need to escape the '/' because it hase no special meaning. In the second regex, the seperator char isn't changed. So the default '/' is used. Now you have to escape all '/' in your pattern. Otherwise the parser is confused. :)

提交回复
热议问题