首页 > 其他 > 详细

RE0509

时间:2014-05-09 14:26:16      阅读:373      评论:0      收藏:0      [点我收藏+]

metacharacters relation to match:

   *:0-multi

   +:1-multi

   ?:0-1

   {n},{n,m},{n,}:the number of matching



string switch

   eg: pattern="lynn|coco"

       src1="hello,my name is lynn"

       result1="lynn"

       src2="hello,my name is coco"

       result2="coco"


ignore case

    eg:pattern="(?i)Lynn"

    src="hello,my name is lynn"

   result="lynn"


multi-repeat-character

   eg:pattern="n{2}"

   src="hello,my name is lynn"

   result="nn"


digital match

   eg:pattern="\d+"

   src="I am 24 years old but 18 years in school"

   result="24","18"

   

   eg:pattern="[0-9]+"

   src="I am 24 years old but 18 years in school"

   result="24","18"

   

optional character match

   eg:pattern="colou?r"

   src1="color"    result=color

   src2="colour"  result=colour






本文出自 “Fighting” 博客,请务必保留此出处http://lynnhome.blog.51cto.com/3654477/1408810

RE0509,布布扣,bubuko.com

RE0509

原文:http://lynnhome.blog.51cto.com/3654477/1408810

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!