 |
 |
 |
 |
| YUCK!! I hate RegEx... looks like you sat on the keyboard ;o).
I am not gonna comment on the RegEx as I dont really know it well enough but for the last part you should be able to do...
"return re.IsMatch(Url);", the if statement is not really needed. |
|
 |
| Just thought of something else...
If string stuff in C# works anything like Java, then your isUrl method is doing a metric shitload of object creation. String concatenation is a killer. It would probably be better to do some cacheing of the strRegex (by making it an instance variable and and doing a 'is null' check before creating it again).
Even better would be to create the entire RegEx object in a static initilizer, but I cant say for certain that C# has them... anyone? |
|
 |
| | Here is the complete regex for URLs (warning: may cause brain to explode): [url]http://internet.ls-la.net/folklore/url-regexpr.html[url] |
|
 |
| yeah, on the final version i do create the regex strings and object as static variables, available whilst the appdomain is loaded.
if i was doing a lot of string concatenation i would use the StringBuilder class, however i dont really define that output above as 'a lot', in fact its only wrapped to make it more legible |
|
 |
| Yeah true@legible. I guess it depends how much you called it. If you used it for check emails on signups to 'tree surgeon monthly' then I guess the hit wouldnt be too great. However, use it for checking validity of every outgoing email on gmail and then you might have a problem :o).
|
|
 |
| |
 |
| This thing rocks, thanks!
-Malachi |
|
 |
| It's still ERROR:
Example: httpwww.com.vn
It's OK..... |
|
 |
| | I converted this to PHP's eregi . I get positives on http://hello |
|
 |
| hahahahhahaha so much code for such a simple task?
I can do the same in few lines hahahah
My site: http://freehosting1.net |
|
 |
| |
 |
| | coooooooooooooooollllllll |
|
 |
| | Concatenating constant strings does not result in any code. |
|
 |
| | watch out the script is sucks |
|
 |
| this is my regexp for email validation
^[a-zA-Z0-9]+([_.-]?[a-zA-Z0-9]+)?@[a-zA-Z0-9]+([_-]?[a-zA-Z0-9]+)*([.]{1})[a-zA-Z0-9]+([.]?[a-zA-Z0-9]+)*$
im not sure its perfect
if somebody know the bug pls contact me at kopenk_3833@yahoo.co.id |
|
 |
| string strRegex = "^(https?://)"
It will fail to match http:// |
|
 |
| Anonymous? Use yoyur brain,
string strRegex = "^(https?://)"
will NOT FAIL on "http://", check it before posting stupid comments :) You know regexps? So u should know what "?" means...
Peace |
|
 |
| It is good enaugh excepting 2 cases:
1. it won't match international domain name or unencoded national characters in query string (áéöä)
2. there are some urls containing double slashes and this shuld be accepted (http://www.domain.com/folder//?param=value) |
|
 |
| A possible solution for the problem mentioned above for Oracle
select * from table
where not regexp_like(webaddress,'^(https?://)?(([[:alnum:]_!~*''().&=+$%-]+: )?[[:alnum:]_!~*''().&=+$%-]+@)?(([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}|([[:alnum:]_!~*''()-]+\.)*([[:alnum:]][[:alnum:]-]{0,61})?[[:alnum:]]\.[a-z]{2,6})(:[[:digit:]]{1,4})?((/*)|(/+[[:alnum:]_!~*''().;?:@&=+$,%#-]+)+/*)$','i') |
|
 |
| And for vb.net
IsUrl = Regex.IsMatch(url, "^(https?://)?(([\w!~*'().&=+$%-]+: )?[\w!~*'().&=+$%-]+@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([\w!~*'()-]+\.)*([\w^-][\w-]{0,61})?[\w]\.[a-z]{2,6})(:[0-9]{1,4})?((/*)|(/+[\w!~*'().;?:@&=+$,%#-]+)+/*)$", RegexOptions.IgnoreCase) |
|
 |
| Thank for cool regex
dave,
http://www.onlinebizbuzz.com |
|
 |
| |
 |
| Thank you for regex !
Jos |
|
 |
| Hi... the Regex for vb.net is not working for me!
why? o_O
Regrats |
|
 |
| | Stop promoting your websites |
|
 |
| |
 |
| current:: if (!preg_match("/^(http(s?):\/\/|ftp:\/\/{1})((\w+\.){1,})\w{2,}$/i", $url))
example:: if (!preg_match('^s?https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:\@&=+\$,%#]+$', $url))
example:: if (!preg_match('^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+\.[\w]{3,4})?((\?\w+(=\w+)?)(&\w+(=\w+)?)*)?', $url)) |
|
 |
| | sale java main tera baap batayega.... |
|
 |
| |
 |
| | Regexp is really a bonus when you are programming in soap. <a href="http://www.earthceuticals.com"> Savon naturel </ a> est faite à partir d'huiles essentielles pures et les huiles végétales pures. Il n'ya pas d'animaux et pas d'ingrédients artificiels ingrédients dans <a href="http://www.earthceuticals.com"> savon naturel </ a>. |
|
 |
| This one rocks:
^(?:(?:(?i)https?(?-i):\/\/)?(?:(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{0,2})(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{0,2}|0)){3})|(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?)*)(?::(?:6[0-5]{0,2}[0-3]?[0-5]?|[1-5][0-9]{0,4}))?))(?:\/|(?:\/[^\s\x00-\x1f]+)+)?(?:(?:\?[^\s\x00-\x1f]+(?:=[^\s\x00-\x1f]+)(?:\&[^\s\x00-\x1f]+(?:=[^\s\x00-\x1f]+)?)*))?$ |
|
 |
| |
 |
| Your regexp doesn't seem to support these cases, with a (possibly blank) password:
http://user:password@host.com
http://user:@host.com
Not that I expect I'll need it myself... |
|
 |
| What about national characters? For example, this is a valid URL I think:
www.host.se/Thingyċäö.html |
|
 |
| |
 |
| |
 |
| Thanks a lot for such a nice snippet of coding. It really helped me a lot!
<a href="http://www.transcription.su">Alex</a>
<a href="http://www.13-kadr.ru">http://www.13-kadr.ru</a> |
|
 |
| |
 |
| I was hoping to convert this so it worked a little differently, but this is my first attempt at regex, and I'm failing miserably. I need to identify and extract a specific portion of a URL via regex, of the form:
http://www.STRING_OF_INTEREST.mywebsite.com
unfortunately, I can't get my stuff to work - anyone have an idea how I can extract the STRING_OF_INTEREST portion? The need is for mod rewrite rules in apache... so, it could start with https/http/www/WWW/etc...
thanks in advance,
skenderbeg |
|
 |
|
return new Regex(strRegex).IsMatch(Url); |
|
 |
| | Thank you. Your email check was the only one I could use in pl/sql |
|
 |
| | I'm trying to extract the basic regex to use in a different platform. Why are some of the "@" characters *outside* the quotes in the string-concetenation? Is this a special use of "@" - I don't do C# |
|
 |
| |
 |
| Thank for the regex,
Regards,
Mike
http://www.growshop.com |
|
 |
| | thank you so much!!!!!!!!!!! |
|
 |
| Cheers
http://www.eternumonline.com |
|
 |
| Nice, thank you.
(http://www.cyclopsvue.blogspot.com) |
|
 |
| |
 |
| I tried a lot of regex for url validation and this is the best one i've seen.
Thanks. |
|
 |
| Thank you for this excellent working and good documented regex!!
i used it for my website
Kochrezepte |
|
 |
| What would a valu vb .net regex expression be for the following pattern:
<core:url address="somewebaddress">
e.g.
<core:url address="www.communities.gov.uk/documents/localgovernment/pdf/155181.pdf"> |
|
 |
| ^(http\:\/\/|[a-zA-Z0-9_\-]+(?:\.[a-zA-Z0-9_\-]+)*\.[a-zA-Z]{2,4}(?:\/[a-zA-Z0-9_]+)*(?:\/[a-zA-Z0-9_]+\.[a-zA-Z]{2,4}(?:\?[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)?)?(?:\&[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)*)$
everyone
plz follw this regular expression for url
http://www.communities.com/regexp/
or
www.communities.com
thanks from
shital jamdade
|
|
 |
| | Thanks. Really helpfull site. |
|
 |
| | <a href="http://www.qualitycodes.com/tutorial.php?articleid=28">http://www.qualitycodes.com/tutorial.php?articleid=28</a> lists all the common regular expressions |
|
 |
| |
 |
| if(p) return true; else return false;
is better written:
return p; |
|
 |
| |
 |
| perhaps you could use the Uri object to check valid url:
Uri.IsWellFormedUriString("http://www.someuri.com", UriKind.RelativeOrAbsolute);
|
|
 |
| | Thanks.Good site.[url=http://mobile-games.bwap.org/free mobile games[/url] |
|
 |
| |
 |
| | Gracias! A very useful post indeed! <a href="http://www.luxurydrugrehab.com/drug-rehab/">Drug Rehab</a> |
|
 |
| |
 |
| |
 |
| |
 |
| |
 |
| I must say that this is a great post. I loved reading it. You have done a great job.
Offset Printing |
|
 |
|
I must say that this is a great post. I loved reading it. You have done a great job.
Spa NYC |
|
 |
| <a href="http://www.sadeceonsekiz.com" rel="dofollow" title="porno film,porno filim,porno">porno film</a>
<font size="4">-<a href="http://www.enguncel.org" rel="dofollow" title="film izle,indirmeden izle,bedava film izle,online izle,seyret,erotik film izle">indirmeden izle</a>-<a href="http://www.nowindir.com" rel="dofollow" title="inndir">inndir</a>-<a href="http://online-muzik-dinle-video.blogspot.com" rel="dofollow" title="online şarki dinle,dinle,mp3 dinleme,müzik dinle,bedava albüm indir">şarkisini dinle</a>-<a href="http://justintv-canlizle.blogspot.com" rel="dofollow" title="justintv izle,turks tv seyret,canli justintv den izle,maçini online izle">justin tv</a>-<a href="http://www.fulindir.tk" rel="dofollow" title="full indir,full program indir,serial,crack,full film,full oyun yükle,ful yükle">yükle</a>-<a href="http://pornofilmfulindir.blogspot.com" rel="dofollow" title="full porno indir-pornosunu indir-pornolari-bedava-full-yukle-download-free">full porno indir</a>---<a href="http://www.sadeceonsekiz.com" rel="dofollow" title="porno izle,porno filim izle,konulu porno film,porno seyret">konulu porno</a>---</font><a href="http://liselilolitakizlaretekalti.blogspot.com" rel="dofollow" title="Liseli Kizlar Etekalti Frikikleri,Am Firikik,18lik Rus Kiz Resimleri,Japon Çitirlar">liseli kizlar</a>-<a href="http://seksimagazin.blogspot.com" rel="dofollow" title="ünlüler,sicak,seksi kizlar,resimleri,resimi,mankenler,sicak videolar">sexsi</a>-<a href="http://guzellolitakizlar.blogspot.com" rel="dofollow" title="kiz resimleri,çiplak lolita resimleri,am fotolari,bakire,etekalti frikik,gögüs,meme">firikik</a>-<a href="http://yesilcamerotikporno.blogspot.com" rel="dofollow" title="yesilcam pornosu,yerli porno izle,yeşilçam sikiş,türk pornosu,yesilcam erotik film">yesilcam pornosu</a>-<a href="http://sikispornosu-izle.blogspot.com" rel="dofollow" title="sikiş,seks videosu,sikis videolari,sexs,anal sikis izle,türk pornosu">anal sikis</a>-<a href="http://bizevdeyiz-tv.blogspot.com/" rel="dofollow" title="bizevdeyiz,sikis izle,porno izle,canli kizlar,canli şov seyret,seks videosu">canli sikis</a>--<a href="http://konulupornofilmizle.blogspot.com" rel="dofollow" title="18lik porno,lolita pornosu,konulu porno film,porno,uzun pornolar izle,pornosu">uzun pornolar</a>----<a href="http://pornofilmfulindir.blogspot.com" rel="dofollow" title="full porno indir-pornosunu indir-pornolari-bedava-full-yukle-download-free">full porno indir</a>
<a href='http://twitter.com/delikarar' rel="dofollow">-<a href='http://recepivedik3sinemacekimi.blogcu.com/' rel="dofollow">recepivedik3sinemacekimi</a>--<a href='http:// kutsaldamacana2idman.blogcu.com/' rel="dofollow">kutsaldamacana2idman</a></a>
<a href='http://xvideos-xx.blogspot.com/' rel="dofollow">xvideos</a>--<a href='http://vidyovidio.wordpress.com/' rel="dofollow">vidyo</a>---"><a href='http://gunlukfilmizle.blogcu.com/' rel="dofollow">>günlükfilm</a>-<a href='http://nowindir.wordpress.com/' rel="dofollow">tikla indir</a>-
<a rel="dofollow" href=http://www.pornotv.cz.cc/">pornotv</a>
<a href="http://www.yenivideolar.tk/" rel=dofollow title="yeni videolar, sicak video">yeni videolar</a>-<a rel=dofollow href="http://kvpfilistin.blogcu.com/">kvp filistin</a>--<a rel="dofollow" href=http://kurtlar-vadisifilistin.blogcu.com/">kurtlarvadisi filistin</a> |
|
 |
| |
 |
| |
 |
 |
 |
 |
Anonymously add a comment: (or register