in reply to Matching an JavaScript object initalizer regex

I have a full-fledged regex parser, and a newer, better interface for it coming out "soon". In the meantime, you might want something like:
qr{ / (?: # char class \[ \^? ]? (?: [^]\\]+ | \\. )* ] | # other schtuff (?: [^[\\\/]+ | \\. )* )* / }x;
It looks right to me. I didn't know a delimiter didn't need quoting in a javascript character class...

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who could use a job
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: Matching an JavaScript object initalizer regex
by Incognito (Pilgrim) on Feb 14, 2002 at 19:53 UTC

    Thanks for the response. The regex looked promising, but unfortunately, when run on my sample test cases, the regex matches less that the original regex did...

    It doesn't seem to work on the simple ones like:

    var objRegex = /"/; var objRegex = /123[abc]456/; var objRegex = /te'st\/as"df/;
    Of course, this is almost out of my league now (it took me quite a while just to grasp the original one)...
      Sorry! I left out the ^ in my character class. I've updated it.

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a (from-home) job
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

        I have verified that your regex does exactly the parsing required in this thread! It's amazing to comprehend the power of Perl and Regex... That one little regex (although not a simple one) could parse all test cases of complex JavaScript (and thus Perl) regular expressions... You're good.... +++++ to you my friend ;)