Mostafa Elkady
Mostafa Elkady

Reputation: 5801

using // instead of https:// or http:// to extract urls from a text

hello, im using Embera (depending on Oembed)

the problem is this

 protected $urlRegex = '~\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))~i';

Embera just understand http or https, how i can make it supports // like that//youtube.com/watch?v=J-iyznGQ

or i want a php regex function fix and url with // to http://

Upvotes: 0

Views: 52

Answers (1)

vks
vks

Reputation: 67978

\b(?:https?:)?//[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))

This should work for you.

Upvotes: 1

Related Questions