user1068473
user1068473

Reputation: 3

Remove urls that have certain domain in them

I have a set of urls for example

I want to remove any url that has feeds.feedburner.com in it. What regular expression would I use? (php)

Upvotes: 0

Views: 99

Answers (2)

Brad Christie
Brad Christie

Reputation: 101604

Why use regex? Use parse_url.

$urlData = parse_url($url);
if ($urlData['host'] != 'feeds.feedburner.com'){
  // Not a feedburner url
}

Shorthand, by the way, is as follows:

if (parse_url($url, PHP_URL_HOST) != 'feeds.feedburner.com'){
  // same outcome
}

Upvotes: 0

Engineer
Engineer

Reputation: 48793

Use this regexp:

/feeds\.feedburner\.com/

Upvotes: 0

Related Questions