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

Masklinn masklinn@REDACTED
Tue Jun 2 14:39:51 CEST 2009

On 2 Jun 2009, at 02:44 , Geoffrey Biggs wrote:
> I'm not sure how well it would work in Erlang, but it's certainly  
> useful in Python for avoiding the headache-inducing backslash  
> acrobatics necessary when writing the occasional complex regular  
> expression.
It also has the fairly big advantage of *not* being limited solely to  
regular expressions. It's less nice than the /pattern/ syntax of Perl/ 
Ruby specifically for regular expressions, but that's mostly because  
since they're all OO to a point in e.g. Ruby you can write `/ 
pattern/.match(whatever)` while in Python you have to compile your  
string (or use some matching function). That however is irrelevant to  

An area where the raw string approach is superior to literal patterns  
syntax (on top of Erlang not having pattern/re objects in the first  
place) is that it also allows writing e.g. UNC paths (which use  
backslashes as separators). I'm pretty sure that's a big factor in C#  
having gone for raw strings rather than literal pattern objects.

Finally, extending (via a prefix) the string syntax instead of adding  
a completely different syntax better opens up future extension venues  
(using other prefixes).

More information about the erlang-questions mailing list