Clean Code Studio Software Resources (Regex)
Tags: regex, tooling, code
Published: 2021-07-28 04:46:39

{% user cleancodestudio %}

[![Twitter Follow](https://img.shields.io/twitter/follow/cleancodestudio.svg?style=social)](https://twitter.com/cleancodestudio) 


---


| Quality Resources | [Regular Expression Info](https://www.regular-expressions.info/)                                                         |                                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| Javascript        | [Regular expressions - JavaScript | MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions) | [ReX.js](https://areknawo.github.io/Rex/)                                                 |
| Php               | [PCRE - Manual - PHP](https://www.php.net/manual/en/pcre.pattern.php)                                                    | [PCRE Pattern Reference](https://www.php.net/manual/en/reference.pcre.pattern.syntax.php) |
| Live Editors      | [Php Regex Editor](https://regex101.com/)                                                                                | [JS Regex Editor](https://regexr.com/)                                                    |





| Email pattern                                                         | /^\\w+(\[\\.-\]?\\w+)\*@\\w+(\[\\.-\]?\\w+)\*(\\.\\w{2,8})+$/                                                                                                                                                                                                                                                                                                                                          |
| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Phone pattern                                                         | /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/                                                                                                                                                                                                                                                    |
| Url pattern                                                           | /https?:\\/\\/(www\\.)?\[-a-zA-Z0-9@:%.\_\\+~#=\]{2,256}\\.\[a-z\]{2,6}\\b(\[-a-zA-Z0-9@:%\_\\+.~#()?&//=\]\*)/                                                                                                                                                                                                                                                                                        |
| Alphabetical characters only pattern                                  | /^\[a-zA-Z\]\*$/                                                                                                                                                                                                                                                                                                                                                                                       |
| Alphabetical and numeric characters only pattern                      | /^\[a-zA-Z0-9\]\*$/                                                                                                                                                                                                                                                                                                                                                                                    |
| Alphabetical, numeric, dashes, and underscore characters only pattern | /^\[a-zA-Z0-9-\_\]+$/                                                                                                                                                                                                                                                                                                                                                                                  |
| IPv4 or IPv6 pattern                                                  | /^(25\[0-5\]|2\[0-4\]\[0-9\]|\[01\]?\[0-9\]\[0-9\]?)\\.(25\[0-5\]|2\[0-4\]\[0-9\]|\[01\]?\[0-9\]\[0-9\]?)\\.(25\[0-5\]|2\[0-4\]\[0-9\]|\[01\]?\[0-9\]\[0-9\]?)\\.(25\[0-5\]|2\[0-4\]\[0-9\]|\[01\]?\[0-9\]\[0-9\]?)$/.test(value) || /^((?:\[0-9A-Fa-f\]{1,4}))((?::\[0-9A-Fa-f\]{1,4}))\*::((?:\[0-9A-Fa-f\]{1,4}))((?::\[0-9A-Fa-f\]{1,4}))\*|((?:\[0-9A-Fa-f\]{1,4}))((?::\[0-9A-Fa-f\]{1,4})){7}$/ |
| IPv4 pattern                                                          | /^(25\[0-5\]|2\[0-4\]\[0-9\]|\[01\]?\[0-9\]\[0-9\]?)\\.(25\[0-5\]|2\[0-4\]\[0-9\]|\[01\]?\[0-9\]\[0-9\]?)\\.(25\[0-5\]|2\[0-4\]\[0-9\]|\[01\]?\[0-9\]\[0-9\]?)\\.(25\[0-5\]|2\[0-4\]\[0-9\]|\[01\]?\[0-9\]\[0-9\]?)$/                                                                                                                                                                                  |
| IPv6 pattern                                                          | /^((?:\[0-9A-Fa-f\]{1,4}))((?::\[0-9A-Fa-f\]{1,4}))\*::((?:\[0-9A-Fa-f\]{1,4}))((?::\[0-9A-Fa-f\]{1,4}))\*|((?:\[0-9A-Fa-f\]{1,4}))((?::\[0-9A-Fa-f\]{1,4})){7}$/                                                                                                                                                                                                                                      |



---

{% user cleancodestudio %}

--- 

Did you know I have a newsletter? 📬

If you want to get notified when I publish new blog posts or make major project announcements, head over to https://cleancodestudio.paperform.co/