in reply to Whats your favorite nonstandard regex quote char?

So what are the monks at large opinion on this ever so trivial a subject? Which alternate regex delimiter do you favour? And what are the arguments behind your opinion (if any)?

I prefer []. Except for the RHS with s///e, because I prefer {} there.

[] is VERY easy to read, Data::Dumper B::Deparse uses it a lot and it will make even more sense when we have Perl 6's regexes, where [] is used for grouping.

{} often delimits code. It makes sense with s///e because the RHS is code, and creates scope, etc etc.

s[\{.*?\}][{$sub[$n++]}]gx;
I escaped the {} to be on the safe side when something is added in front of it in a future version.

Also note that syntax highlighting helps more than choosing the right delimiter.

Juerd
- http://juerd.nl/
- spamcollector_perlmonks@juerd.nl (do not use).

Replies are listed 'Best First'.
Re: Re: Whats your favorite nonstandard regex quote char?
by demerphq (Chancellor) on Apr 22, 2003 at 20:21 UTC

    I dont understand your reference to Data::Dumper in this context. Whats that all about?


    ---
    demerphq

    <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

      I dont understand your reference to Data::Dumper in this context. Whats that all about?

      Neither do I, but that is because I meant B::Deparse, not Data::Dumper. Sorry :)

      B::Deparse uses q['] instead of '\'', for example. I like that.

      Juerd
      - http://juerd.nl/
      - spamcollector_perlmonks@juerd.nl (do not use).