[erlang-questions] parsing radius detail file with time stamp

Thomas Lindgren <>
Fri Jun 15 14:50:43 CEST 2007

--- jm <> wrote:

> I'm attempting to parse a radius detail file using
> yecc. It seems that
> leex is not widely available leading to manually
> writing a scanner.
> Having not done much with parse at this level before
> I would like to
> avoid manually writing anything to do with parsing a
> little longer. Does
> anyone have any suggestions on how to parse a file,
> using yecc or any
> other method, which looks like this?

The quick and nasty approach is to use string:tokens
of course; something like this if you have a string:

  [ string:tokens(Line, "=") 
    || Line <- string:tokens(String, "\n") ]

and then getting rid of whitespace, doing
postprocessing and error checking of that (which might
be substantial). It has many limitations, but
sometimes you just need the quick thing.

The main issue is to handle quoting properly for this
approach, which string:tokens does not do; however,
it's probably straightforward to rewrite that function
to take care of the issue for your domain. Hope it


You snooze, you lose. Get messages ASAP with AutoCheck
in the all-new Yahoo! Mail Beta.

More information about the erlang-questions mailing list