Basically, I got fed up with writing some regexes and substitutions with /s and then having to choose a different delimiter to avoid leaning toothpicks, then a different delimiter somewhere else to avoid conflicts with the fiorst choice and so on.

Then I discovered that using balanced delimiters meant that I rarely had to switch delimiters. Of the choices, () are just too common in regex, {} look like code blocks and are also used in regex.

I tried <> for a while, and they are a pretty good choice, but of the four, despite that they are themselves fairly common in regex, I found that I preferred []. So I now use them for all my regexes. I think I only encountered one time when I had problems with using them and that waas in a monster regex attempting to parse XML.

Historically, I am a strong believer in consistancy, and being able to use the same delimiter for all my regex (and other quote-like constructs) just makes my code more self-consistant.

Personally, I can't wait for characters to become consistantly 32-bits. Not only would that do away with the variable byte-length encoding problem that comes from utf and the performance hit that entails, but it gives more than enough space in the character set to introduce a dozen or so more sets of balanced pairs that would allieviate much of this type of problem completely.

I noticed that Bob Bemer, the father of ASCIIdied recently. Maybe it's time to let ASCII go to and invent a completely new set of symbols for computing:)


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon

In reply to Re^2: x2 Inserting numbers between parenthese matches in regexp by BrowserUk
in thread Inserting numbers between parenthese matches in regexp by Melroch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.