Skip to content

Instantly share code, notes, and snippets.

@SidneyBasa
Last active February 22, 2023 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SidneyBasa/2ac83f1dbe4752fcdf9ba8244f74a932 to your computer and use it in GitHub Desktop.
Save SidneyBasa/2ac83f1dbe4752fcdf9ba8244f74a932 to your computer and use it in GitHub Desktop.

Title (Tutorial on Matching a URL with Regular Expressions)

This is a tutorial on building a URL search with a regular expression. This will cover part or most of the syntax.

Summary

I will be describing the syntax of a regular expression provided by the Challenge 17 documentation. The following code snippet is from the readme.md file which describes searching for a matching email using a regular expression: /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/

Table of Contents

Regex Components

^ is a carrot ? is zero or one () Parenthesis in this context is used for grouops \d is for numbers [] brackets are to match character classes

  • is to match one or more { } curly brackets is the range in length . is to match a literal period
  • is to match all ?$ is to match a zero or one groups

Anchors

Quantifiers

There are two quantifiers * seen

Grouping Constructs

There are four () groups seen

Bracket Expressions

Brackets are used to find any charaters a through z upper and lower And used to find digits zero through nine

Character Classes

Chater classes are the text that are within the bracket

The OR Operator

Alterations {2 through 6} are used to find the length

Flags

Character Escapes

Author

Sidney Basa From Seattle Washington Security Guard for Hospitals Studying Software Programming Was a student at the University of Washington Seattle campus in 2012 has two associates degrees at Seattle Community College Assosicates of Arts Associates of Science in Diesel and Heavy Machinery

https://github.com/SidneyBasa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment