Regex not recognizing links across multiple lines

Hi all,

I’ve got a messaging page on my app and run some regex so that links of all formats are identified. This works well apart from when there is more than one link across two lines, e.g.
www.bbc.co.uk
www.google.com

The current regex is:
(?:(?:https?|ftp)://|\b(?:[a-z\d]+.))(?:(?:[^\s()<>]+|((?:[^\s()<>]+|(?:([^\s()<>]+)))?))+(?:((?:[^\s()<>]+|(?:(?:[^\s()<>]+)))?)|[^\s`!()[]{};:’".,<>?«»“”‘’]))?

Does anyone know how I can make this work across multiple lines? Any help would be appreciated!

Can’t you just start with a find and replace to replace the carriage return so that it is all on one line and then you run the regex?

It depends where you are using the Regex in Bubble, ie in a way that lets you add Regex modifiers - but one approach is to add Regex modifier of g & m (global and multiline modifiers)

https://www.w3schools.com/jsref/jsref_regexp_m.asp

image

That’s how I’m using it. So I guess add the /regexp /m in?

This topic was automatically closed after 70 days. New replies are no longer allowed.