欢迎光临
我们一直在努力

Regular Expression Library(1)-.NET教程,C#语言

建站超值云服务器,限时71元/月

expression:  ^([a-za-z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|([a-za-z0-9\-\.]+))\.([a-za-z]{2,3}|[0-9]{1,3})(\]?)$  rating: 10 [ rate]  
description:   email validator that adheres directly to the specification for email address naming. it allows for …  
matches:  [asmith@mactec.com], [foo12@foo.edu], [bob.smith@foo.tv]  [ more details]  
non-matches:  [joe], [@foo.com], [a@a]  [ test expression]  
submitted by:  andy smith (asmith@mactec.com)  

expression:  ^\d{1,2}\/\d{1,2}\/\d{4}$  rating: 4 [ rate]  
description:   this regular expressions matches dates of the form xx/xx/yyyy where xx can be 1 or 2 digits long an…  
matches:  [4/1/2001], [12/12/2001], [55/5/3434]  [ more details]  
non-matches:  [1/1/01], [12 jan 01], [1-1-2001]  [ test expression]  
submitted by:  steven smith (ssmith@aspalliance.com)  

expression:  ^[a-za-z]{1,2}[1-9][0-9]{0,1} {0,1}[1-9][a-za-z]{2}$  rating: 4 [ rate]  
description:   matches uk postcodes  
matches:  [g1 1aa], [eh10 2qq], [sw1 1zz]  [ more details]  
non-matches:  [g111 1aa], [x10 ww], [ddd 5ww]  [ test expression]  
submitted by:  dave sparks (dave.sparks@cedalion.co.uk)  

expression:  /\*[\d\d]*?\*/  rating: 2 [ rate]  
description:   if you need to extract or remove any /* */ sytle comments from any java, javascript, c, c++, css, e…  
matches:  [/* my comment */], [/* my multiline comment */], [/* my nested comment */]  [ more details]  
non-matches:  [*/ anything here /*], [anything between 2 seperate comments], [\* *\]  [ test expression]  
submitted by:  chris craft (cjcraft@mail.com)  

expression:  ^\d{5}-\d{4}|\d{5}|[a-z]\d[a-z] \d[a-z]\d$  rating: 2 [ rate]  
description:   this expression matches three different formats of postal codes: 5 digit us zip code, 5 digit us zi…  
matches:  [44240], [44240-5555], [g3h 6a3]  [ more details]  
non-matches:  [ohio], [abc], [g3h6a3]  [ test expression]  
submitted by:  steven smith (ssmith@aspalliance.com)  

expression:  ^(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])$  rating: 2 [ rate]  
description:   regexp for validating the format of ip addresses. this works great with the asp.net regularexpressi…  
matches:  [127.0.0.1], [255.255.255.0], [192.168.0.1]  [ more details]  
non-matches:  [1200.5.4.3], [abc.def.ghi.jkl], [255.foo.bar.1]  [ test expression]  
submitted by:  g. andrew duthie (graymad@att.net)  

expression:  ^\w+[\w-\.]*\@\w+((-\w+)|(\w*))\.[a-z]{2,3}$  rating: 2 [ rate]  
description:   email validation. with this short expression you can validate for proper email format. its short…  
matches:  [bob-smith@foo.com], [bob.smith@foo.com], [bob_smith@foo.com]  [ more details]  
non-matches:  [-smith@foo.com], [.smith@foo.com], [smith@foo_com]  [ test expression]  
submitted by:  eric lebetsamer (edl2@hotmail.com)  

expression:  ^#?([a-f]|[a-f]|[0-9]){3}(([a-f]|[a-f]|[0-9]){3})?$  rating: 2 [ rate]  
description:   tests for valid html hexadecimal color codes. the # symbol is optional. and it will except either t…  
matches:  [#00ccff], [#039], [ffffcc]  [ more details]  
non-matches:  [blue], [0x000000], [#ff000]  [ test expression]  
submitted by:  chris craft (cjcraft@mail.com)  

expression:  (\w+)\s+\1  rating: 1 [ rate]  
description:   this expression uses a backreference to find occurrences of the same word twice in a row (separated…  
matches:  [hubba hubba], [go go], [12 12]  [ more details]  
non-matches:  [may day], [gogo], [1212]  [ test expression]  
submitted by:  steven smith (ssmith@aspalliance.com)  

expression:  ^\d$  rating: 1 [ rate]  
description:   matches exactly 1 numeric digit (0-9).  
matches:  [1], [2], [3]  [ more details]  
non-matches:  [a], [324], [num]  [ test expression]  
submitted by:  steven smith (ssmith@aspalliance.com)  

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Regular Expression Library(1)-.NET教程,C#语言
分享到: 更多 (0)