php - Extract specific part of URL from string -
I need to remove only parts of a URL with PHP, but I set the point where the clearance off I'm struggling for. I have used a regex to remove the entire URL from a long string like this:
$ regex = '/ \ b (https | FTP | file?): \ / \ / [- a ? Z0-9 + & amp; @ # \ /% = ~ _ | $:.,;] * [One-Z0-9 + & amp; @ # \ /% = ~ _ | $] / I '; Preg_match_all ($ regex, $ href, $ matches); The result is the following string:
http://www.cambridgeenglish.org/test-your-english/&sa= U & Amp; Amp; Ei = a4rbU8agB-zY0QWS_IGYDw & amp; Amp; Vedas = 0CFEQFjAL & amp; Amp; USG = AFQjCNGU4FMUPB2ZuVM45OoqQ39rJbfveg Now I just want to remove this bit I basically How can anyone get this idea? Do I need to run a regex or can I add in the initial one? will be regex below string Explanation: & amp; After "text" itemprop = "text"> end after getting rid of everything your PHP The code will be,
& Amp; ; Amp string & amp; Amp matches . . * matches any character with zero or more times. $ .
Comments
Post a Comment