Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript escaping //

Tags:

javascript

how will i escape the slashes // in javascript

var j = /^(ht|f)tp(s?)://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$;/
like image 689
maztt Avatar asked Jul 15 '26 00:07

maztt


1 Answers

Use a \ for escaping, like this:

var j = /^(ht|f)tp(s?):\/\/([\w-]+\.)+[\w-]+(\/[\w-./?%&=]*)?$;/
like image 132
Nick Craver Avatar answered Jul 17 '26 15:07

Nick Craver



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!