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

Tuncer Ayaz tuncer.ayaz@REDACTED
Tue Jun 17 22:29:15 CEST 2008


On Tue, Jun 17, 2008 at 12:13 PM, Tuncer Ayaz <tuncer.ayaz@REDACTED> wrote:
> On Tue, Jun 17, 2008 at 11:08 AM, Mats Cronqvist
> <mats.cronqvist@REDACTED> wrote:
>> 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
>
> I hope you guys don't mind me mentioning that if we discuss
> regex implementations we should at least make sure to use
> one with an implementation that uses NFAs. That should not be too hard.
>
> http://swtch.com/~rsc/regexp/regexp1.html (Thompson NFA info)
> http://en.wikipedia.org/wiki/Comparison_of_regular_expression_engines

Well, I do object myself for mentioning already mentioned
information :). Sorry, should have taken care to read the
complete thread more carefully. Mea culpa, no excuses allowed.



More information about the erlang-questions mailing list