[DGD] parse_string regular_expression

Shentino shentino at gmail.com
Mon Apr 12 05:07:14 CEST 2010


If I had to guess it would be:

/\*([^*]|\*[^/])*\*/

Expanded thusly:

/\* ( [^*] | \* [^/] ) * \*/

Start with a /*, then a sequence of zero or more of (not *, or a * followed
by a not /), then end with a */

It's easily confusing enough, as the clash between * and \* makes escaping
things a bit tricky.


On Sun, Apr 11, 2010 at 7:49 PM, <aishiteru at charter.net> wrote:

> Hello everyone,
>
> I am pulling my hair out trying to get a regular expression for single-line
> comments and
> c-style comments to be matched with parse_string().  The regular
> expressions I have tried are below.
>
> single-line comments:
> //[^*\n]+/
>
> c-style single-line and multi-line comments:
> /\\/\*(.*?)\*\//
> or
> \/\*[^*]+(\*\/)?
>
> Each of these gives me a malformed regular expression error.
> What am I doing wrong?  These were all suggested over the DGD Intermud
> channel.  I'm on a MUD using a modified Gurbalib mudlib.
>
> Joseph
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
>



More information about the DGD mailing list