Need Regex to filter a url inside a text

Hi,

is there a regex to filter urls like this ?

Schöne, helle 1,5 Zimmer Wohnung in Berlin, Wilmersdorf
https://www.immobilienscout24.de/expose/94868376?PID=38685218&CCWID=$CWID_CONTACT$&utm_medium=email&utm_source=system&utm_campaign=default_fulfillment_0&utm_content=default_expose_redesign

Scout-ID: 94868376
Kaltmiete: 450 €
Wohnfläche: 43,76 m?

Thanks Armin

Hi,

Something like that could be a good start :
https?://[\w$-.+!*’(),%]+

But it depends on the context.

: Stanislas CARON

Hi,

Something like that could be a good start :
https?://[\w$-.+!*’(),%]+

But it depends on the context.

Thanks,

but is does not work
Armin

Minor edits:

Code :
https?://[\w$-.+!*’(),%/?=]+

Look here for testing:
http://regexr.com/3ftt6

: Lutz EPPERLEIN

Minor edits:

Code :
https?://[\w$-.+!*’(),%/?=]+

Look here for testing:
http://regexr.com/3ftt6

Thanks Lutz,

but it seems that 4d regex works different to the regex tester

[]19401506;“Your comment here…”[/]

Armin

Hmm,

try this
Code :
.https?://[\w$-.+!’(),%/?=]+
or try to escape the parentheses and/or the dot within the brackets like this
Code :
.https?://[\w$-.+!’(),%/?=]+

Often, regex debugging is a kind of trial and error

In regex101, the slash has to be escaped like here :
https://regex101.com/r/ShVvmM/1

Same problem, it stops after https://www.

I tried this
.https?://[\w$-.+!’(),%/?=]+
.https?://[\w$-.+!’(),%/?=]+

and the hint from Stanislas with .https?://[\w$-.+!’(),%/?=]+

[]19401549;“Your comment here…”[/]

You want to get the whole text in bold or just the starting “https://www.immobilienscout24.de/”?
If whole text “https?://.*\n” works for me with your example.
No need to escape the slash.

This pattern is working with your example

(https{0,1}://?[.A-Za-z0-9/?&=$_]*)

I don’t guarantee that some characters are not missing.
And you miss some URL as ftp://

Thank you all for the help.

But I’m using 4D v12.6 and it seems that the match regex command differs to higher 4d versions.

with 4D v15 most of your code samples works fine, with 4D v12 not.

So I’ve to delay this until the end of the year when I do the switch to v16

Best Regards Armin