tags:

views:

38

answers:

2

Hey!

Im attepting to find the regex to pull the

 http://{any_string}.blogspot.com/feeds/{any_string}/comments/default

out of

 <link rel="alternate"
 type="application/atom+xml"
 title="{any_string}"
 href="http://{any_string}.blogspot.com/feeds/{any_string}/comments/default"
 />

I know basics of regex and using eregi but im unsure of how to include constant characters such as the http://, etc in the regex expression!

Thanks!

A: 
http://.*\.blogspot\.com/feeds.*/comments/default

Where . matches newlines

Brian
A: 

Characters just match themselves (except some special ones like dot and backslash):

http://\S+\.blogspot\.com/feeds/\S+/comments/default

As pointed out, with php's preg_match, you may have to escape the solidii:

preg_match("/http:\/\/\S+\.blogspot\.com\/feeds\/\S+\/comments\/default/", string_to_match_against);
brianary
You would either need to escape the `/` or use different delimiters in the preg_match call.
Doug Neiner
You need to escape the full stops.
Matti
@Doug Neiner: Sure, but that's not really to do with the regex, but how it's encoded in the host language.
brianary