|
![]() |
|
| Author |
|
|||||||
|
eXemplar
Posts: 910
Location:
|
I'm after a decent regular expression which will match almost any mainstream protocol, along with user and/or password + ports with subdirectories.
I've been lookin on google for a bit, because I saw one that was a few hundred characters in length(at least), but I must've removed the link from my bookmarks, and can't seem to find it. Anyone know ? |
|||||||
| #0 10:09pm 24/02/05 |
|
|||||||
|
system
|
--
|
|||||||
| #0 |
|
|||||||
|
whoop
Posts: 7893
Location: Brisbane, Queensland
|
wtf? is this mysql queries or something?
|
|||||||
| #1 10:20pm 24/02/05 |
|
|||||||
|
brett
Posts: 1672
Location: Sydney, New South Wales
|
^:\/\/$ will match *://* - thats all protocols (?)
|
|||||||
| #2 10:39pm 24/02/05 |
|
|||||||
|
James
Posts: 41
Location: Brisbane, Queensland
|
more info please dude...
|
|||||||
| #3 10:42pm 24/02/05 |
|
|||||||
|
brett
Posts: 1673
Location: Sydney, New South Wales
|
oh i had to read the rest of it, use explode(":", string) to get the user/pass.
if its always protocol://blah:blha@hostname.com:port/blah/blah exp[0] is the protocol name, remove("\/\/", exp[1]) == user, remove("@", exp[2]) == pass, bah i cant be bothered to keep explaining, you get the idea. explode/str_replace is all you need. |
|||||||
| #4 10:42pm 24/02/05 |
|
|||||||
|
scuzzy
Posts: 10967
Location: Brisbane, Queensland
|
||||||||
| #5 10:45pm 24/02/05 |
|
|||||||
|
spidz
Posts: 8321
Location: Brisbane, Queensland
|
aint over till the fat lady sings
^^ thats a regular expression. |
|||||||
| #6 10:48pm 24/02/05 |
|
|||||||
|
eXemplar
Posts: 911
Location:
|
teq, yes, that would match all protocols, but not if they were missing the protocol information (ie, assumed http).
Doesn't matter, I have one that will match, but fails on some. Still, if anyone knows of this uber regexp, gimme a buz. |
|||||||
| #7 11:05pm 24/02/05 |
|
|||||||
|
system
|
--
|
|||||||
| #7 |
|
|||||||
|
| ||||||||