Regular Expression --------- match URL or URL, regular expression ---------

Source: Internet
Author: User

Regular Expression --------- match URL or URL, regular expression ---------

Regular Expressions match URLs or URLs

 

Regular Expression (http | ftp | https): \ // [\ w \-_] + (\. [\ w \-_] +) + ([\ w \-\., @? ^ = % & Amp ;:/~ \ + #] * [\ W \-\@? ^ = % & Amp ;/~ \ + #])? Matching http://regxlib.com/Default.aspx | http://electronics.cnet.com/electronics/0-6342366-8-8994967-1.htmlmismatch www.yahoo.com

Regular Expression ^ \ {2} [\ w-] + \ ([\ w-] [\ w-\ s] * [\ w-] + [$ ]? $) | ([\ W-] [$]? $ )) Matching \ server \ service | \ server \ my service | \ serv_001 \ service $ mismatch \ my server \ service | \ server $ \ service

Regular Expression ^ (http | https | ftp) \: // ([a-zA-Z0-9 \. \-] + (\: [a-zA-Z0-9 \. & amp; % \ $ \-] + )*@)? (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1 -9] {1} [0-9] {1} | [1-9]) \. (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1- 9] {1} [0-9] {1} | [1-9] | 0) \. (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1- 9] {1} [0-9] {1} | [1-9] | 0) \. (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1- 9] {1} [0-9] {1} | [0-9]) | ([a-zA-Z0-9 \-] + \.) * [a-zA-Z0-9 \-] + \. [a-zA-Z] {2, 4}) (\: [0-9] + )? (/[^/] [A-zA-Z0-9 \.\,\? \ '\/\ + & Amp; % \ $ # \ = ~ _ \-@] *) * $ Match http://www.sysrage.net | https: // 64.81.85.161/site/file. php? Cow = moo's | ftp: // user: pass@host.com: 123 does not match sysrage.net
Regular Expression ^ ([a-zA-Z] \:|\\\ [^ \/\\:*? "<> |] + \ [^ \/\\:*? "<> |] +) (\ [^ \/\\:*? "<> |] +) + (\. [^ \/\\:*? "<> |] +) $ Matches c: \ Test.txt | \ server \ shared \ Test. t does not match c: \ Test | \ server \ shared \ Test .?

Regular Expression ^ (http | https | ftp) \: // ([a-zA-Z0-9 \. \-] + (\: [a-zA-Z0-9 \. & amp; % \ $ \-] + )*@) * (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1-9] {1} [0-9] {1} | [1-9]) \. (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1- 9] {1} [0-9] {1} | [1-9] | 0) \. (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1- 9] {1} [0-9] {1} | [1-9] | 0) \. (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1- 9] {1} [0-9] {1} | [0-9]) | localhost | ([a-zA-Z0-9 \-] + \.) * [a-zA-Z0-9 \-] + \. (com | edu | gov | int | mil | net | Org | biz | arpa | info | name | pro | aero | coop | museum | [a-zA-Z] {2 }))(\: [0-9] +) * (/($ | [a-zA-Z0-9 \. \,\? \ '\ + & Amp; % \ $ # \ = ~ _ \-] +) * $ Match http://site.com/dir/file.php? Var = moo | https: // localhost | ftp: // user: pass@site.com: 21/file/dir does not match site.com | http://site.com/dir //

Regular Expression ^ ([a-zA-Z] \ :) (\ [^ \\/:*? <> "|] * (? <! []) * (\. [A-zA-Z] {2, 6}) $ matches C: \ di ___ r \ fi_sysle.txt | c: \ dir \ filename.txt does not match c: \ dir \ file? Name.txt
Regular Expression ^ ([a-zA-Z0-9] ([a-zA-Z0-9 \-] {} [a-zA-Z0-9])? \.) + [A-zA-Z] {} $ match regexlib.com | this. is. a. museum | 3com.com does not match the notadomain-.com | helloworld. c | .oops.org
Regular Expression ^ (ht | f) tp (s ?)) \://)? (Www. | [a-zA-Z].) [a-zA-Z0-9 \-\.] + \. (com | edu | gov | mil | net | org | biz | info | name | museum | us | ca | uk) (\: [0-9] +) * (/($ | [a-zA-Z0-9 \. \,\;\? \ '\ + & Amp; % \ $ # \ = ~ _ \-] +) * $ Match with www.blh.com: 8103 | www.blh.com/blh.asp? Sort = ASC | www.blah.com/blah.htm?blado not match www. state. ga | http://www.blah.ru

Regular Expression \ B ([\ w-] + ://? | Www [.]) [^ \ s () <>] + (? : \ ([\ W \ d] + \) | ([^ [: punct:] \ s] |/) matching http://foo.com/blah_blah | (Something like http://foo.com/blah_blah) | http://foo.com/blah_blah_ (wikipedia) | (Something like http://foo.com/blah_blah_ (wikipedia) | http://foo.com/blah_blah. http://foo.com/blah_blah. |

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.