S
S
Svoboo2022-02-22 15:13:20
Regular Expressions
Svoboo, 2022-02-22 15:13:20

How to make regular expression find all occurrences in strings?

There is such a regular expression with which I am trying to pull domains from links on pages:

\/\/([\w.-]+).*\/ with g flag

https://regex101.com/r/QM9IPY/1
But it only finds the first occurrence in the string. How to fix it so that it finds generally all occurrences between // and / ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexandroppolus, 2022-02-22
@Svoboo

https://regex101.com/r/UuZy3s/1

S
Shellr57s, 2022-02-22
@Shellr57s

\/{2}(.+?)\/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question