Adoption of perl/javascript-style regexp syntax

Ulf Wiger <>
Thu Jun 4 07:44:01 CEST 2009

Richard O'Keefe wrote:
> On 3 Jun 2009, at 6:50 pm, mats cronqvist wrote:
>>  this discussion is about how to represent strings with many escapes,
>>  not about regexps per se.
> You did read the subject?

I even went back and read the original mail.
He did say in there:

"The only issue I have with it is that I have to
specify regexps as strings."

So presumably the OP is eagerly awaiting a library which
supports regexps represented as something other than
strings... ROK, you have a small project on your hands. :)

> Actually, it's about people mistakenly THINKING they need 
 > strings with many escapes, when what they really need is
 > to get away from strings.

There's no getting away from strings in practice,
and some strings have many escapes in them.

Going back to the OP, the string "(?<!\\\\)#" can of course
already be expressed in Erlang without escaping issues:


Forgoing *all* syntactical convenience, we would instead write:


...but of course that would be awkward.
(Of course, when generating code, I will have to write it as
'cons' tuples, but when generating code, this is fine.)

Surely we can all agree that syntactic sugar is sometimes
a Good Thing. Too much of it is not, and one man's convenience
is another man's cruft.

Perhaps we can agree that there can be differences in opinion
as to whether there is still room for more syntactic sugar
regarding strings in Erlang?

The claim that anyone who's unhappy with the current convenience
level is simply confused, and in need of the therapeutic pain
caused by rubbing up against double escaping in complex strings,
is subjective. Wouldn't you agree?

Ulf W

More information about the erlang-questions mailing list