[DGD] string parsing..
Nico Lammers
n.lammers at home.nl
Thu Sep 27 20:03:49 CEST 2001
> On Thu, Sep 27, 2001 at 07:26:15PM +0200, Nico Lammers wrote:
> [...]
> >
> > But now I still don't know how to use parse_string() ;-)
> >
> > It seemed to me that the examples I gave would be easy to do.. but maybe
> > I'm wrong?
>
> Hmm... using Elemel's code (untested):
>
> static string
> regsub(string str, string regexp, string subst)
> {
> string *bits;
>
> bits = parse_string("whitespace = /" + regexp + "/\n"
> + "text = nomatch\n"
> + "TEXT: text TEXT\n"
> + "TEXT:", str);
> return implode(bits, subst);
> }
>
> You could probably do this without the implode if you used a different
> token than whitespace for the regexp and an extra function to replace
> the token with the substitute text.
*L* Umm, well.. I'm still kinda lost.. I'll figure this parse_string thing
out
though.. some day ;) Thanks anyway.
*Will do it the erm, "hard" way*
-- Nico Lammers
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list