regex - How do i extract a link from a longer link using php? -


After

No one knows the best way would be to remove a link from another link that was what I was thinking, here Here's an example:

If I link in the following format:

  http://www.youtube.com/watch?v=35HBFeB4jYg or http: // it. Answers.yahoo Com / question / index? QID = 20080520042405AApM2Rv or https://www.google.it/search?q=rap+tedesco&aq=f&oq=rap+tedesco&aqs=chrome.0.57j62l2.2287&sourceid=chrome& I.e. = UTF-8 # hl = hi & amp; Sclient = psy-ab & amp; Q = migliori + programatori & amp; OQ = migliori + programatori & amp; Gs_l = serp.3..0i19j0i13i30i19l3.9986.13880.0.14127.14.10.0.4.4.0.165.931. 6j4.10.0 ... 0.0 ... 1c.1.7.psy-ab.tPmiWRyUVXA & amp; PBX = 1 & amp; BAV = on.2, or.r_cp.r_qf &. Fp = ffc0e9337f73a744 & amp; BIW = 1280 & amp; Bih = 699   

As soon as I know about removing web pages:

  http://www.youtube.com http: // It.answers. Yahoo.com https://www.google.it   

I was wondering what else can I use regular Express ions with PHP to achieve it, whether regular Expression is also the way to go?

function.

  $ link = "https://www.google.it/search?q=rap+tedesco"; $ ParseUrl = parse_url ($ link); $ SiteName = $ parseUrl ['scheme']. ": //" $ ParseUrl ['Host']; Using   

Regexp .

  preg_match ('@http (s?): // ([\ w] + \.) {1} ([\ w] \) + @', $ link, $ mail Account).? Match $ [0];   



Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -