[erlang-questions] builtin regexp functions in Erlang/OTP R12B-3

Mats Cronqvist mats.cronqvist@REDACTED
Tue Jun 17 11:08:48 CEST 2008


Bjorn Gustavsson wrote:
> Mats Cronqvist <mats.cronqvist@REDACTED> writes:
>
>   
>>   i think not allowing backreferences is the correct choice for erlang. 
>> after all, erlang is about reliability. and it seems not being 
>> POSIX-compliant has worked for 20 years.
>>     
>
> Note that Patrik has implemented the re BIFs to be rescheduable,
> meaning that even a badly written regular expression will not prevent
> the emulator from running other Erlang processes (even in the non-SMP
> emulator).
>   

  that is of course an example of the sound thinking that makes the 
emulator the excellent product it is.
  even so, if i was responsible for, say, a telecom server product, i 
would be worried about a feature (backreferences) where it's so easy to 
slip up and peg the CPU at 100%. i would imagine that my application 
would run into problems if someone wrote a regexp that used up a CPU-second.

> As noted in the EEP, some regexp libraries would have been hard or
> impossible to make rescheduable.
>   

  a crucial point. fwiw, i think using PCRE is a sound decision. the 
only reasonable alternative i'm aware of is the plan 9 regexp lib. did 
you look at that?
  "Libregexp9 is a port of Plan 9's Unicode-capable regular expression 
library. It is small and simple and provides the traditional extended 
regular expressions (without modern complications like {} and various \x 
character classes). It supports Unicode via wide character or UTF-8 
encoding."

http://swtch.com/plan9port/unix
 



More information about the erlang-questions mailing list