Extract url from string via preg match in php -


  $ str = 'window.location.href = "http://my-site.com";'   

मैं यूआरएल को $ str से निकालना चाहता हूं मैं preg_match () में अच्छा नहीं हूं। हालांकि निम्न कोड के साथ:

  preg_match ('/ (http | https | ftp | ftps) \: \ / \ / [a-zA-Z0-9 \ - \।] + \ । [A-zA-Z] {2,3} (\ / \ S *)? / ', $ Str, $ लिंक); अगर (खाली ($ link [0])) {गूंजती "कुछ नहीं मिला!"; } else {echo $ link [0]; }   

मैं परिणाम प्राप्त करने में सक्षम हूं http://my-site.com "। मैं को बाहर करने के लिए preg_match () को कस्टमाइज़ करना चाहता हूं "; परिणाम से कृपया मदद करें!

  & lt; php $ str = 'window.location.href = " http://my-site.com "; '; Preg_match ('/ window \ .location \ .href = "(। *?)"; /', $ Str, $ परिणाम); प्रतिफल $ परिणाम [1]; //http://my-site.com & gt ;?   



Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -