Edward's Tech Site

this site made with Next.js 13, see the code

HOWTO: Oct 08, 2023 - Regex
Learn the basics of regular expressions (regex) and how to use them in JavaScript
  • what are regular expressions and what are they used for
    • regular expressions, often referred to as regex, is a pattern-matching syntax used for searching, extracting, and manipulating text based on patterns
    • it allows you to define a pattern or a set of rules that describe a specific sequence of characters or a textual structure
    • it is often used in programming to validate certain patterns such as email addresses, postal codes or custom syntax such as product ids
    • regular expressions are also used for searching, text extraction, text transformation and parsing of commands, e.g. when creating a computer language or compiler
  • what is the history of regex
    • regular expressions were being used as early as the 1950s and 1960s in computer science and linguistics
    • the grep command, introduced in Unix in the 1970s, allowed users to search for patterns using regular expressions
    • during the 1980s, regular expressions were included in many languages being developed such as C++ and Haskell
    • particularly the language Perl embraced regular expressions as a core feature
    • by 2000 nearly all major computer languages had support for regular expression, e.g. Python, Java and JavaScript
    • by the early 2000s all SQL variants had regular expression support
    • since then regular expressions have found adoption as a search option in non-developer tools such as Microsoft Excel/Word, Google Sheet/Documents and editors such as Notepad++
  • code is here
  • live site is here
  • learn regex basics
      1. find an interactive learning site that has takes you through the commands step by step with questions and answers, work through it
      1. while working through this keep another site open where you can experiment with what you learn in the first site
      1. create a JavaScript site where you can experiment with what you learn in JavaScript regexs