问题

I have this pattern .*?[a-z]([a-z])([a-z])([a-z]).*?(\s+)(\d+) from some online generator but it's not working.

I need pattern which allow:

"minimum 3 char length string, next single space, and next minimum 1 char integer" [abc 1] or the same but in different order "minimum 1 char integer, next single space, and next minimum 3 char length string" [3 gtf].

Thanks.

回答1:

Try this one:

\d+\s\w{3,}|\w{3,}\s\d+

It either matches:

One or more digits (\d+), followed by a single whitespace (\s), followed by three or more word characters (\w{3,}) (this is [a-zA-Z0-9], you can replace this part with [a-zA-Z] if you'd like).

Three or more word characters (this is [a-zA-Z0-9], you can replace this part with [a-zA-Z] if you'd like), followed by a single whitespace, followed by one or more digits.

Regex101

回答2:

The following expression should do what you describe:

[a-z]{3,}\s\d+|\d+\s[a-z]{3,}

Some notes:

The {3,} construct allows you to specify repetitions within a given range. In general, it's {min,max}, but you can leave out either min or (as here) max to have an open-ended range. You can also specify an exact number of repeats by specifying a single number, e.g. {99}.

The expression is essentially two complete expressions switched with alternation. Regular expressions don't allow you to say "exactly these things, in any order".

I've used [a-z] to match the characters in the non-numeric part, as this is what you did in your original example.

来源:https://stackoverflow.com/questions/32970438/html5-input-pattern

html input patten,Html5 input pattern相关推荐

  1. html5 规定输入字段,HTML5 Input属性详解

    本篇教程探讨了HTML5 Input属性详解,希望阅读本篇文章以后大家有所收获,帮助大家HTML5+CSS3从入门到精通 . < value 属性 value 属性规定输入字段的初始值: rea ...

  2. HTML5 input placeholder 颜色 改动

    David Murdoch:Chrome支持input=[type=text]占位文本属性,但下列CSS样式却不起作用: CSS input[placeholder], [placeholder], ...

  3. HTML5 input 类型

    HTML5 Input 类型 HTML 4.01 与 HTML 5 之间的差异 以下类型是 HTML5 中的新类型:color, date, datetime, datetime-local, mon ...

  4. 使用CSS修改HTML5 input placeholder颜色

    有三种实现方式:伪元素(pseudo-elements).伪类( pseudo-classes)和Notihing. WebKit和Blink(Safari,Google Chrome, Opera1 ...

  5. HTML5 input()标签

    一.标签定义 1.<input> 标签规定了用户可以在其中输入数据的输入字段. 2.输入类型是由 type 属性定义. 二.input的参数 <input type="类型 ...

  6. [html] 说说你对HTML5中pattern属性的理解

    [html] 说说你对HTML5中pattern属性的理解 好像是判断input在输入时按下tab键跳转到下一个input的优先级 个人简介 我是歌谣,欢迎和大家一起交流前后端知识.放弃很容易, 但坚 ...

  7. input 强大的 input 标签

    2019独角兽企业重金招聘Python工程师标准>>> <input type="color"value="#6fbc6d"> & ...

  8. html input日期值,input标签设置时间值

    研究了两天javascript日期相关的内容,一句话总结:"浏览器可以用上十万年,因为javascript支持的时间范围就是这么长". 通过实验来看,比较好用的是type=&quo ...

  9. input css年月日,input标签的type为date,显示的日期格式样式更改

    这个///是改不了---的,这是谷哥自带的功能样式,只能改颜色背景色等,如果要那种效果可以用日历插件 有个取巧的方法,一个不能改的input覆盖在input type="date" ...

最新文章

  1. MySQL的binarylog处理
  2. Visual Stdio VS 错误 error : 0xC00000FD: Stack overflow. 更改堆栈空间解决栈溢出问题
  3. 剑指offer 算法 (发散思维能力)
  4. 一分钟了解阿里云产品:容器服务概述
  5. python自动测试u_自动化测试——Selenium+Python之下拉菜单的定位
  6. LiveVideoStack成立5周年生日快乐!一路走来,感谢有你!
  7. java汉字转化accic_Java自主学习贴
  8. Hadoop YARN:调度性能优化实践
  9. 内涝预测过程的噪音_第七章噪声解析
  10. SuperPro 3000U 编程器电源部分
  11. Mutex和内存可见性
  12. 使用SDL2中SDL_CreateWindow()函数时报错跳进wincore.cpp(wntdll.pbd not load)
  13. 扫描死链接的工具xenu
  14. Intel处理器执行环境
  15. Android studio 写xml的不能自动补全的问题
  16. python read csv dtype_如何使用pandas将csv列作为dtype列表读取?
  17. 治疗感冒的常用中成药
  18. ORACLE匹配手机号,Oracle正则表达式语法介绍及实现手机号码匹配方法
  19. 计算机应用与基础性考实训题答案,《计算机应用基础与实训》 考证练习题09年.pdf...
  20. 【大数据审计】无须编程,批量提取图片并相似度比对,进行费用真实性审查

热门文章

  1. 零基础学Python(二)
  2. Android原生TabLayout使用全解析,看这篇就够了
  3. boot返回码规范 spring_三种自定义SpringBoot返回的状态码
  4. 面试官问我会canvas? 我可以绘制一个烟花动画
  5. 关于“高速网络链路,提高的是数据发送速率而不是传播速率“笔记
  6. 【生信】常见测序数据格式
  7. mpstat命令和/proc/stat文件
  8. 产品沉思录精选:差异化才是生存的根本
  9. leetcode 440. 字典序的第K小数字(精)
  10. PHP在线支付接口集成教程