Tag Archives: 正则表达式

Java 正则表达式替换小心: $ / 符号

尝试使用正则表达式处理内容时, 需要小心替换字符串中是否包含:$ or /, 譬如:
Pattern pattern = Pattern.compile(“\\{C0\\}”);
Matcher matcher = pattern.matcher(“Price:

More…

Posted in Java | Tagged , , , | Leave a comment

正则表达式: 电子邮件格式检验

自己用的:
\\w+([-.]\\w+)*@\\w+([-.]\\w+)*\\.[a-z]{2,3}
可能不是最完美的, 但基本没大问题.
Java测试类一并奉上:
//定义正则表达式
private static final String REGEX_EMAIL = "\\

More…

Posted in Java | Tagged , | Leave a comment

Email Parser 邮件地址解析器, 从给定内容中抓取邮件地址&自动排除重复&过滤指定邮箱

功能介绍:

从给定的文字内容中 解析Email地址, 并显示出来. 同时支持QQ提取.

More…

Posted in ActionScript, Flex | Tagged , , , , | Leave a comment

PHP中使用正则表达式(实例: 搜索String中的Email地址)

以下代码简单演示在PHP中使用正则表达式从String中搜索Email地址:
/**
* 从String中通过正则表达式找到所有的Email地址.
* @param $str
* @return array 搜索到的Email地址组成的array.
*/
public stati

More…

Posted in PHP | Tagged , | Leave a comment

Flex:使用正则表达式替换String

需求: 通过某些字符串生成文件名称, 简单要求: 仅允许数字或字母及”_” 代码:

var regExp:RegExp = new RegExp(“[^A-Za-z0-9_]“, “g”); // 正则表达式, 将非字母数字或下划线的字符替换为”_”, 全部替换.
fi

More…

Posted in ActionScript | Tagged , , , | Leave a comment
  • Page 1 of 2
  • 1
  • 2
  • >