Date
Apr. 18th, 2024
 
2024年 3月 10日

Post: Useful RegEx

Useful RegEx

Published 12:09 Sep 20, 2015.

Created by @ezra. Categorized in #Technology, and tagged as #RegEx.

Source format: Markdown

Table of Content

Hex Value

/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/

匹配示例:

#a3c113

错误示例:

#4d82h4

HTML Tag

/^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/

匹配示例:

<a href="{{ site.url }}/">Meniny+</a>

错误示例:

<img src="img.jpg" ⌥="Some image>" />

IP Address

/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/

匹配示例:

123.45.67.89

错误示例:

256.45.67.89

URL

/^(https?:\/\/)?([\dA-Za-z\.-]+)\.([A-Za-z\.]{2,6})([\/\w \.-]*)*\/?$/

匹配示例:

{{ site.url }}/something

错误示例:

https://google.com/some/file!!.html

E-mail

/^([A-Za-z0-9_\.-]+)@([\dA-Za-z\.-]+)\.([A-Za-z\.]{2,6})$/

匹配示例:

[email protected]

错误示例:

[email protected]
Pinned Message
HOTODOGO
I'm looking for a SOFTWARE PROJECT DIRECTOR / SOFTWARE R&D DIRECTOR position in a fresh and dynamic company. I would like to gain the right experience and extend my skills while working in great teams and big projects.
Feel free to contact me.
For more information, please view online résumé or download PDF
本人正在寻求任职 软件项目经理 / 软件技术经理 岗位的机会, 希望加⼊某个新鲜⽽充满活⼒的公司。
如有意向请随时 与我联系
更多信息请 查阅在线简历下载 PDF