Skip to content

Instantly share code, notes, and snippets.

View Landon0615's full-sized avatar

Landon Waddell Landon0615

View GitHub Profile
@Landon0615
Landon0615 / JavaScript:RegexTutorial.md
Last active August 30, 2021 19:52
I have complied this short tutorial of JavaScript Regex from the "Retrieved from links" found at the bottom of each section

Title JavaScript: Regex Tutorial

Hello this is a tutorial reviewing regex, which is short for regular expression. Regex is a sequence of characters that defines a specific search pattern. When included in code or search algorithms, regular expressions can be used to find certain patterns of characters within a string, or to find and replace a character or sequence of characters within a string. They are also frequently used to validate input.

Summary

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

One of the more useful regexes on the list. It matches any HTML tag with the content inside. As usually, we begin with the start of the line.