[erlang-questions] idea: service pack one
Wed Nov 14 11:09:26 CET 2007
On Nov 14, 2007 9:26 AM, Thomas Lindgren <thomasl_erlang@REDACTED> wrote:
> > a little off-topic: Maybe not _any_ regexp, but a
> > subset -- how would
> > you handle 'a[b-y]+[0-9][^a-z]*u' in a
> > straightforward way? It can't
> > be transformed into a binary with many variables and
> > a lot of guards,
> > it needs a state machine.
> Either that or some compiler magic. An Erlang-level
> implementation would be fairly straightforward if we
> had deep guards.
Actually, if there's going to be some magic behind the scenes, why
restrict this extended pattern matching to binaries? I would very much
like to be able to write something like for example
[_*, term1, _+, term2+, _*] = L
in order to find out if there is a term1 preceding a series of term2
in the list, with at least one list element between them. In other
words, full regexp matching on erlang terms instead of on characters.
I suppose this would have to be marked somehow so that it's visible
that it isn't the same thing as a normal match (in the same way as
deep guards might need to be distinguished from regular ones).
More information about the erlang-questions