News for hackers. Stuff that matters.
Re:Perl 5.26.0 released by Ardren on Thursday June 01, 2017 @08:20AM (#14459630)
Javascript has regex literals

    /foo\sbar/i;
Is the same as:

    new RegExp('foo\\sbar', 'i');
Re:Perl 5.26.0 released by hoytech on Thursday June 01, 2017 @08:52AM (#14459796)
One thing that annoys me a bit about the JS syntax though: As far as I know, JS regexp literals don't have custom delimiter support. For instance in perl you can do this:

    $str =~ m{/some/path/\w+}
But in JS you need to escape the / characters, or use a normal string as an argument to Regexp, in which case you need to escape the backslashes:

    /\/some\/path\/\w+/
    Regexp("/some/path/\\w+")