[erlang-questions] Adoption of perl/javascript-style regexp syntax

Robert Virding <>
Mon Jun 1 15:39:49 CEST 2009


2009/6/1 Dmitrii Dimandt <>

> I've just come across re and I like it :)
>
> The only issue I have with it is that I have to specify regexps as strings.
> This leads to ugly-as-hell constucts like these:
>
> {ok, Re} = re:compile("(?<!\\\\)#")
>
> It actually tries to find two backslashes there... Or just one? I don't
> know :) What if Erlang could allow this:
>
> Re = /(?<!\\)#/
>
> ?
>
> Benefits:
> - Less error-prone
> - Expressions written this way can be parsed and compiled by the compiler
> (boost in performance, syntax checked at compile-time)


Without getting into discussions if we *want* to do this I can say that I
doubt this will boost performance as the PCRE package which the base of re
takes its input regular expression as a (C) string. From what I can
understand its various parts aren't modular. This is a pity.

Robert


More information about the erlang-questions mailing list