samedi 7 novembre 2020

regex - block whitespaces in url

I'm using a regular expression to match Facebook url.

((http|https)://)?(www[.])?facebook.com/.+

It accepts:

facebook.com/xxxxx
www.facebook.com/xxxxx
http://facebook.com/xxxxx
https://facebook.com/xxxxx

But it still accepts whitespaces after /:

facebook.com/(spaces there)

How can I prevent it?

Aucun commentaire:

Enregistrer un commentaire