Can somone help fix up my simple regex query, please?

Posted by Pure.Krome on Stack Overflow See other posts from Stack Overflow or by Pure.Krome
Published on 2010-04-13T04:59:42Z Indexed on 2010/04/13 5:02 UTC
Read the original article Hit count: 268

Filed under:
|

Hi folks,

yep - another noob regex query, which I can't seem to get.

I'm trying to get all matches for the string foo.mydomain.com/ or foo.mydomain.com:1234/ or foo.mydomain.com:<random port>/ but any other paths do not match, ie. foo.mydomain.com/bar or foo.mydomain.com/bar/pewpew

I tried to use: foo.mydomain.com(.*)/$ ( starts with anything, then foo.mydomain.com, then any thing after that .. until a slash. then end. (this search query is anchored to the end of the line).

but that doesn't work. It doesn't match when i pass in foo.mydomain.com:1234 but it correct says foo.mydomain.com/bar/pewpew is not a match (as expected).

any ideas?

© Stack Overflow or respective owner

Related posts about regular-expression

Related posts about regex