Reputation: 15976
I need a regular expression that identify special links.
I have an array with links, for example this one
array[1] = "http://domain.com/dfdf"
array[2] = "http://domain.com/dfgf"
array[3] = "http://domain2.com/derf"
I want to use a regular expression that extract links from this array under a specific domain (for example domain2)
I'll get an array
array[1] = "http://domain2.com/derf"
I'm looking for the pattern only (I use PHP)
Upvotes: 0
Views: 412
Reputation: 12064
This will match https as well as http links:
#^https?://domain2\.com/#
Upvotes: 0
Reputation: 655239
This regular expression should do it:
^http://domain2\.com/
And converted into PCRE with /
as delimiter:
/^http:\/\/domain2\.com\//
But you can use another character if you want:
~^http://domain2\.com/~
Upvotes: 2