RegExp
I have never talked to anyone else who uses regual expressions when they write code but I'm going to ask any way....
I'm useing this RegExp...
temp_Reg = /www\x2E\w{1,}\x2E\w{3}/i;
I'm useing the match() method to get it to mach eather of the fallowing...
Quote: www.bja888.com
bja888.com
The only proublem is i dont know how to make it match www. or not www.
Any sugestions?
timjpriebe posted this at 20:25 — 5th April 2005.
He has: 2,667 posts
Joined: Dec 2004
Is this a Perl RegEx or PHP?
I think PHP has slightly different syntax that Perl, which I'm used to using. That's why I'm asking.
bja888 (not verified) posted this at 20:41 — 5th April 2005.
They have: 5,633 posts
Joined: Jan 1970
Jscript.net but the idea is the same. I can look up the proper syntax, but i dont know the approach I should use.
timjpriebe posted this at 21:11 — 5th April 2005.
He has: 2,667 posts
Joined: Dec 2004
Maybe something like this
/(www\.)*[^\.]+\.[^\.]{2,3}/
That will match something that starts with zero or more www. 's, followed by one or more non-period 's, then a period, then 2 or 3 non-periods.
I haven't tested it, but this should match both of yours, plus things that end with two-letter extensions as well.
Tim
http://www.tandswebdesign.com
bja888 (not verified) posted this at 00:12 — 6th April 2005.
They have: 5,633 posts
Joined: Jan 1970
Ph thank you, the thing I was missing is you can have it match 0 or more. I will just do 0 or more ws then 0 or 1 ".". Thank you.
Abhishek Reddy posted this at 00:47 — 6th April 2005.
He has: 3,348 posts
Joined: Jul 2001
Are you only looking to match .com domains?
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.