maztt
maztt

Reputation: 12294

javascript escaping //

how will i escape the slashes // in javascript

var j = /^(ht|f)tp(s?)://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$;/

Upvotes: 2

Views: 286

Answers (1)

Nick Craver
Nick Craver

Reputation: 630529

Use a \ for escaping, like this:

var j = /^(ht|f)tp(s?):\/\/([\w-]+\.)+[\w-]+(\/[\w-./?%&=]*)?$;/

Upvotes: 11

Related Questions