reg_action
function check_email($win)
{
$win = trim($win);
$reg = '/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/';
if (preg_match($reg, $win) == 1) return true;
return false;
}
<form action="" method="post" style="text-align: center ">
<input type="text" name="email_1117" placeholder="请输入您的email(必填)" style="margin:1em;" id="winput_email">
<input id="winput_email_check" style="border: 0 ;color: red;">
<input type="submit" name="add" value="追加" id="w_submit">
</form>
<script>
document.getElementById("winput_email").addEventListener("change", wonchange);
function wonchange() {
var w = document.getElementById("winput_email").value;
var reg = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
console.log(reg.exec(w) !== null && reg.exec(w).index === 0)
if (reg.exec(w) !== null && reg.exec(w).index === 0) {
document.getElementById("winput_email_check").value = ''
document.getElementById("w_submit").style.display = 'inline';
} else {
winnerhtml = '请输入正确的email';
document.getElementById("winput_email_check").value = winnerhtml;
document.getElementById("w_submit").style.display = 'none';
}
}
</script>
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions
\w
匹配一个单字字符(字母、数字或者下划线)。
等价于[A-Za-z0-9_]。
例如, /\w/ 匹配 "apple," 中的 'a',"$5.28,"中的 '5' 和 "3D." 中的 '3'。
+
匹配前面一个表达式1次或者多次。等价于 {1,}。
例如,/a+/匹配了在 "candy" 中的 'a',和在 "caaaaaaandy" 中所有的 'a'。
*
匹配前一个表达式0次或多次。等价于 {0,}。
例如,/bo*/会匹配 "A ghost boooooed" 中的 'booooo' 和 "A bird warbled" 中的 'b',但是在 "A goat grunted" 中将不会匹配任何东西。
http://wiki.ubuntu.org.cn/Python%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E6%93%8D%E4%BD%9C%E6%8C%87%E5%8D%97
re.compile('\d+').search('按时打卡的23423') is None
{'words': '大型\t雕铣机\t哪个\t牌子\t好\t?', 'postags': 'b\tn\tr\tn\ta\twp', 'parser': '2:ATT\t4:ATT\t4:ATT\t5:SBV\t0:HED\t5:WP', 'netags': 'O\tO\tO\tO\tO\tO', 'role': [{4: 'A0:(0,3)'}]}
feature ATT SBV HED 相邻
re.compile('ATT\\t\d+:SBV\\t\d+:HED\\t\d+').search( '2:ATT\t4:ATT\t4:ATT\t5:SBV\t0:HED\t5:WP') is None
或 (a|b)
re.compile('HED\\t\d+:VOB\\t\d+:(WP|ADV\\t\d+:CMP)').search('3:ATT\t3:ATT\t4:SBV\t0:HED\t4:VOB\t7:ADV\t4:CMP\t4:WP') is not None
reg_action的更多相关文章
- Web jsp开发学习——Servlet提交表单时用法
实现提交表单以后判断输入的信息是否符合条件 若符合条件 先新建servlet Sevlet的两种声明方式,二选一即可 再到web.xml里注册 register.jsp就是表单的界 ...
随机推荐
- 156. Merge Intervals【easy】
Given a collection of intervals, merge all overlapping intervals. Example Given intervals => me ...
- 正常断开连接情况下,判断非阻塞模式socket连接是否断开
摘自:http://blog.chinaunix.net/uid-15014334-id-3429627.html 在UNIX/LINUX下, 1,对于主动关闭的SOCKET, recv返回-1,而且 ...
- iOS开发 -李洪强-清除缓存
// // SetViewController.m // dfhx // // Created by dfhx_iMac_001 on 16/4/5. // Copyright © 2016年 ...
- 【转】Python 第三方 http 库-Requests 学习
原文地址:http://www.itwhy.org/%E8%BD%AF%E4%BB%B6%E5%B7%A5%E7%A8%8B/python/python-%E7%AC%AC%E4%B8%89%E6%9 ...
- 用e2fsck修复受损的linux文件系统
今天想尝试直接从linux deepin拷贝一些文件到windows 10而不重启电脑,所以就安装Ext2Mgr了并加载了linux的几个磁盘: / /home 再次重启系统想进入linux的时发现系 ...
- jsp时间格式化
<fmt:formatDate value="${start.time }" pattern="HH:mm" />
- 使用html替代excel导出数据的优势和技巧
之前一直使用NPOI或者微软office官方组件导出excel,但是多多少少会有写小问题,不是数据量不能过大(xls的问题,用xlsx就可以更大了),就是速度慢,或者文件体积太大 中途采用过csv(逗 ...
- HP proliant服务器从usb启动
1,开机出现自检画面开始按F9进入设置,进入BIOS 选择standard boot order(rpl),把usb driver放在第一位,保存好 2,按F1开始启动. (注:我使用ubuntu14 ...
- java网络编程1-查询Internet地址
//经过dns查询后的结果会缓存起来,成功结果永久缓存,失败结果会缓存10s,通过下面的方法设置成功和失败的缓存时间 // 0为不缓存,-1为永不过期,其它单位为s Security.setPrope ...
- Hadoop2的HA安装(high availability):nfs+zookeeper
前面介绍过hadoop的简单安装和FA安装,在这里将介绍几种hadoop2中HA(高可用性)安装,HA技术使hadoop不再存在单点namenode的故障. 先来第一种:nfs+zookeeper H ...