Hm, try http://[A-Za-z0-9_\.\-]*.w
Hope this helps,
Oleksiy G.
Main Topics
Browse All TopicsI am trying to figure out a regular expression to match some URL's for a website. The expression needs to match the main URL and any random URL's.
The main URL would be: http://www.website.com
The random URL's look something like this:
http://su1.website.com
http://ax.bx.su.website.co
http://aa.bb.cc.dd.website
Basically it needs to match http://<INSERT ANYTHING>.website.com
The best I came up with was the following expression, which does not work:
http://[^.]*.website.com
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hm, try http://[A-Za-z0-9_\.\-]*.w
Hope this helps,
Oleksiy G.
m(http://((([a-z0-9][-a-z0
This is actually for a web filtering program, and I'm trying to add a rule to allow a URL. I tried Oleksiy and ozo's suggestions, but it threw an error about invalid characters. However, based on the URL and your examples, I did write this:
http://[A-Za-z0-9\.?]*.web
Does anyone see an issue of why I shouldn't use it? It needs to match:
http://<INSERT ANY STRINGS>.website.com
Where you Replace <INSERT ANY STRINGS> with anything like
www
www2
aa.bb.cc
a.1.22123nfwf
Looks OK, but you may want delimit your dots, perhaps like
http://[A-Za-z0-9\.?]+\.we
Business Accounts
Answer for Membership
by: teraplanePosted on 2007-02-20 at 15:24:44ID: 18575103
Not sure which language you are using, but in perl it would be | and print "Match found\n";
# the $ symbol anchors pattern to end of string
$a =~ m|http://.*\.website.com$/