This article summarizes almost all the regular expression codes that match the website. I will introduce the usage methods one by one. If you have any need, please refer to them. This article summarizes almost all the regular expression codes that match the website. I will introduce the usage methods one by one. If you have any need, please refer to them.
Script ec (2); script
URI is the type of resources available on the Web-HTML documents, images, video clips, programs, etc.-are located by an Uniform Resource Identifier ("URI.
Grouping:
^ ([^ :/? #] + ):)? (// ([^ /? #] *)? ([^? #] *) (? ([^ #] *)? (#(.*))?
12 3 4 5 6 7 8 9
Example
The Code is as follows: |
|
Regular Expression (http | ftp | https): // [w-_] + (. [w-_] +) + ([w -.,@? ^ = % &:/~ + #] * [W -@? ^ = % &/~ + #])? Matching http://regxlib.com/Default.aspx | http://electronics.cnet.com/electronics/0-6342366-8-8994967-1.html Does not match www.yahoo.com Regular Expression ^ \ {2} [w-] + \ ([w-] [w-s] * [w-] + [$]? $) | ([W-] [$]? $ )) Matching \ serverservice | \ servermy service | \ serv_001service $ Mismatch \ my serverservice | \ server service | \ server $ service Regular Expression ^ (http | https | ftp): // ([a-zA-Z0-9.-] + (: [a-zA-Z0-9. & % $-] + )*@)? (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 .,? '\/+ & % $ # = ~ _-@] *) * $ 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]: |\[ ^ /\:*? "<> |] + \ [^ /\:*? "<> |] +) (\ [^ /\:*? "<> |] +) + (. [^ /\:*? "<> |] +) $ Matching c: Test.txt | \ serversharedTest.txt | \ serversharedTest. t Does not match c: Test | \ servershared | \ serversharedTest .? Regular Expression ^ (http | https | ftp): // ([a-zA-Z0-9. -] + (: a-zA-Z0-9. & % $-] + )*@) * (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 .,? '\ + & % $ # = ~ _-] +) * $ 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] :) (\ [^ \/:*? <> "|] * (? Match C: di___rfi_sysle.txt | c: dirfilename.txt Does not match c: dirfile? Name.txt
Regular Expression ^ ([a-zA-Z0-9] ([a-zA-Z0-9-] {} [a-zA-Z0-9])?.) + [A-zA-Z] {2, 6} $ Match regexlib.com | this. is. a. museum | 3com.com Unmatched 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 .,;? '\ + & % $ # = ~ _-] +) * $ Match www.blh.com: 8103 | www.blh.com/blh.asp? Sort = ASC | www.blh.com/blh.htm?blah Does not match www. state. ga | http://www.blah.ru
Regular Expression B ([w-] + ://? | Www [.]) [^ s () <>] + (? :( [Wd] +) | ([^ [: punct:] s] | /))) Matching http://foo.com/blah_blah | 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/. | | | Http://foo.com/blah_blah, | http://www.example.com/wpstyle? P = 364. | http ://? Df. ws/123 | rdar: // 1234 | rdar:/1234 | http: // userid: password@example.com: 8080 | http: // userid@example.com: 8080 | http: // userid: password@example.com Does not match no_ws.example.com | no_proto_or_ws.com |/relative_resource.php
|
Can match any URL