maudulus
maudulus

Reputation: 11035

Implementing regex to find span with class inside javascript file

I am using regex in python to find <span class="dlog"...>Whatever you want to put here</span>, and have been using pythex and crossreferencing regexpal to match the case. However, inside of my javascript file, where I am defining a variable containing the regex, as follows:

    var tokenRe = /<span class=\"dlog\"(.*?)\>(.*?)\</span>/;

I am getting an error: SyntaxError: Invalid regular expression: missing /. Thus, I need help trying to implement this regex inside of my javascript file.

Thanks !

Upvotes: 0

Views: 136

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191779

You did not escape the slash for </span. You also don't need so many escapes because of the regex literals:

var tokenRe = /<span class="dlog"(.*?)>(.*?)<\/span>/

Upvotes: 3

Related Questions