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:)
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |