0

I need a php code for search and find all urls in a Text(.txt) file but the urls started from webhost

for example:

text.txt:

hello , thank you for order our website: http://webhost.org
your website: http://yourwebsite.com

the php code just showing site.com

please help me

thanks

1 Answers1

0

You can use a Negative Lookahead to ensure http:// is not followed by webhost

 (?:https?:\/\/)(?!webhost)(.*?\.(?:com|org))

will match anything after http:// including .com or .org unless webhost is found after it

filipeglfw
  • 751
  • 7
  • 13