http://qs1969.pair.com?node_id=926332


in reply to Demarcate Regexes with Unicode

One lamented aspect of Perl is that regexes get really hard to read. ....

If you learn to regex, they're really easy to read :)

why not use a sigil ...

Because its not on the standard keyboard!

Also, its a delimiter not a sigil

Which is why I prefer to use @ for quoting like s@@@ </sarcasm>

But seriously, this is exactly why i prefer \ or «

$ perl -MO=Deparse -e " s\\\g " s///g; -e syntax OK $ perl -MO=Deparse -e " s«««g " s///g; -e syntax OK
or even </sarcasm>

But seriously, between balanced delimiters like

perl -MO=Deparse -e " s {}//g " perl -MO=Deparse -e " s {}\\g " perl -MO=Deparse -e " s {}vvg " perl -MO=Deparse -e " s {}()g " perl -MO=Deparse -e " s {}[]g " perl -MO=Deparse -e " s {}<>g " perl -MO=Deparse -e " s<><>g "

I stick to keyboard characters

s///x
s===x
s,,,x
s!!!x
s~~~x
s>>>x
s}}}x
and the special case s'''x

The x means magic

Replies are listed 'Best First'.
Re^2: Demarcate Regexes with Unicode
by toro (Beadle) on Sep 16, 2011 at 08:57 UTC
    its a delimiter not a sigil

    Well, it's a section sign, but lawyers sometimes call it Sigil. (I know that namespace is already occupied in this circle.)

    Because its not on the standard keyboard!

    If you're on a Mac it's quite easy to make, and if you're on Ubuntu it's pretty easy to make. On Windows too, I still remember

    Alt + Num0141
    from typing Spanish on a US keyboard.

    Anyway, I admit this approach is not for everybody. I like your suggestions (but I don't have a key for «).