> so, i guess i'm looking for a subexpression that says "if there are any of > the characters in the range of a-z, 0-9, and - (the only valid characters > for a subdomain), then they must be followed by a dot, but the existence of > the subdomain is optional". > this seems to work: ^https?:\/\/([a-z0-9-]+\.)?example\.com([^"]*) does not match http://badexample.com/foo matches http://example.com/foo http://bob.example.com/foo