You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-7
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,10 @@ SO THAT I can understand the search pattern the regex defines
10
10
11
11
how to create a gist and its URL.
12
12
13
-
Instead of creating a repository, you’ll publish a GitHub gist. GitHub describes a gist as a simple way to share code snippets with others. It’s also an ideal way to demonstrate a technique, teach a principle, or show off a solution. It functions just like a repository, and you’ll use Markdown to create it, just as you do with your READMEs. Gists can include code, images, links, and anything else you can include in a README.
13
+
Instead of creating a repository, you’ll publish a GitHub gist. GitHub describes a gist as a simple way to share code snippets with others. It’s also an ideal way to demonstrate a technique, teach a principle, or show off a solution. It functions just like a repository, and you’ll use Markdown to create it, just as you do with your READMEs. Gists can include code, images, links, and anything else you can include in a README.
14
14
15
-
After you’ve cloned the starter code, learn how to create a gistLinks to an external site.. You can also watch this video on how to use gistsLinks to an external site..
15
+
* After you’ve cloned the starter code, learn how to create a gist
16
+
* You can also watch this video on how to use gists
16
17
17
18
## What Is a Regex?
18
19
* A regex, which is short for regular expression, 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.
@@ -23,13 +24,9 @@ After you’ve cloned the starter code, learn how to create a gistLinks to an ex
23
24
24
25
* Each component of this regex has a unique responsibility to make sure that a user enters an email address that begins with an unspecified number of characters preceding the @ symbol, followed by a domain.
25
26
26
-
* Before you get started, watch this introduction to regular expressions videoLinks to an external site. and read Regex Tutorial: Matching a UsernameLinks to an external site. to learn how to identify the different components that make up a regex.
27
-
28
-
* If you need any additional help, there are many resources on the web. Feel free to do your own research to find one that can help you complete this assignment.
27
+
* Before you get started, watch this introduction to regular expressions video and read Regex Tutorial: Matching a Username to learn how to identify the different components that make up a regex.
29
28
30
29
Once you have a better understanding of what these different parts of a regular expression do, you’ll need to explain what they do for a specific regex.
Copy file name to clipboardExpand all lines: draft.md
+17-15
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Matching a Hex Value: A Regex Tutorial
2
2
3
-
EXAMPLE DRAFT : This gist tutorial explains how to match a hex value, search and replace a hex value, and verify a hex value.
3
+
EXAMPLE DRAFT : This gist tutorial explains how to match a hex value as it relates to JavaScript.
4
4
5
5
## Introductory Paragraph
6
6
@@ -15,25 +15,27 @@ A regular expression (regex) is a jumble of characters that web developers use t
15
15
16
16
## Table of Contents
17
17
18
-
*[Tutorials](#tutorials)
18
+
*[Tutorial](#tutorial)
19
19
*[Hex Value Matching](#hex-value-matching)
20
-
*[Search and Replace a Hex Value](#search-and-replace-a-hex-value)
21
-
*[Verifying the Hex Value](#verifying-the-hex-value)
22
20
*[About the Author](#about-the-author)
23
21
24
-
## Tutorials
22
+
## Tutorial
25
23
24
+
###
26
25
* WHEN I read through each section of the tutorial, THEN I find a detailed explanation of what a specific component of the regex does
27
-
** EACH section breaks down EACH COMPONENT of the regex AND EXPLAINS what it does for the hex value.
28
-
29
-
### Hex Value Matching
30
-
31
-
Let's define a search pattern using regex to search for a hex value.
32
-
33
-
* Who what when where why how
34
-
1. one
35
-
2. two
36
-
3. three
26
+
* EACH section breaks down EACH COMPONENT of the regex AND EXPLAINS what it does for the hex value.
27
+
28
+
The forward slashes / denote the beginning and the end of a regex expression and will define a search pattern within JavaScript. Let's focus on the values between the forward slashes.
29
+
^ symbol. For this hex value, the carat ^ indicates the start of the string or line.
30
+
31
+
# symbol. The # sign is a token that matches a # character. (character code 35)
32
+
? symbol. This question mark (?) matches a number between 0 and 1 of the preceding token, which is #.
33
+
() The parentheses groups multiple expressions together so as to extract a substring or use a back reference.
34
+
[] Within the parentheses, there are square brackets. The square brackets contain a range of numbers (a-f) and/or case-sensitive letters (0-9). The brackets will match any single character in this range.
35
+
- The hyphen represents a range of letters or numbers in a square bracket.
36
+
{} The curly braces (in this particular case with the hex value) contain one number. This digit {n} indicates that that value inside the brackets [] occurs or matches exactly n times.
37
+
| The pipe symbol stands for alternation. It behaves like a boolean (values of true or false). It matches the expression before or after the | symbol.
38
+
$ The dollar sign means "end." It matches the end of the string, in this case.
0 commit comments