
正则表达式
文章平均质量分 81
iteye_16325
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
15位和18位身份证的正则表达式及其验证
1、简单的正则表达式: (1)preg_match("/^(\d{18,18}|\d{15,15}|\d{17,17}x)$/",$id_card) (2)preg_match("/^(\d{6})(18|19|20)?(\d{2})([01]\d)([0123]\d)(\d{3})(\d|X)?$/",$id_card) (3)preg_match("/(^\d{15}$/)|(...原创 2008-12-18 10:46:56 · 740 阅读 · 0 评论 -
Java中正则表达式的使用
在Java中,我们为了查找某个给定字符串中是否有需要查找的某个字符或者子字串、或者对字符串进行分割、或者对字符串一些字符进行替换/删除,一般会通过if-else、for 的配合使用来实现这些功能 。如下所示: public class Test{ public static void main(String args[]) { String str="@Sha...2008-12-25 15:19:09 · 136 阅读 · 0 评论 -
正则表达式——实例分析
(1)应用:计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)String.prototype.len=function(){return this.replace([^x00-xff]/g,”aa”).length;}------------------------------------------------------------------------------------...2008-11-30 20:18:00 · 376 阅读 · 0 评论