Regular expressions is used to detect particular character patterns within a string. Inside one string, you may also locate and modify a symbol or a group of letters. They're also often used to double-check data. An example is to valid an e-mail addresses, the regex matches character information.
This is the regex code for this tutorial is: /^([a-z0-9_.-]+)@([\da-z.-]+).([a-z.]{2,6})$/
The following anchors are used to contain this regular expression: ^ to start, and $ to finish.
We used + in this example to indicate that there is another sequence that needs to be matched as a greedy quantifier. Another greedy quantifier we used was 2,8 to signal that the input should be a minimum of 2 characters and a maximum of 8 characters.
The character class /d is utilized in this regular expression, which in JavaScript classifies the usage of any digit from 0 to 9.
In this example, three groups are being captured. The username of the e-mail account [a-z0-9_.-] belongs to Group #1. The domain name or e-mail service utilized [da-z.-] is captured in the second group. Lastly, the third group captures the domain extention (.com or .net) [a-z.]{2,8}
[Regular Expression Tutorial] (https://coding-boot-camp.github.io/full-stack/computer-science/regex-tutorial) [Regex tutorial — A quick cheatsheet by examples] (https://medium.com/factory-mind/regex-tutorial-a-simple-cheatsheet-by-examples-649dc1c3f285) [regexLearn] (https://regexlearn.com/)
Hi, I'm Tanya Gonzalez. For any questions or suggestions, you can contact me at [My GitHub] (https://github.com/tanyaleepr)