As readability is somewhat absent in the below shown Regular expression literal, I would like to split it up over several lines. How would I do this and what does need to change/be escaped?
regex = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;
Thanks
JavaScript doesn’t support multiline regexes. You could construct a regex from a string, though:
(I hope I got the string building syntax correct – I’m not a JavaScript person, so if this doesn’t work, let me know)