Please enable JavaScript.
Coggle requires JavaScript to display documents.
Larsen: Ch. 10.1.2 RegEx (Lucy May) (Commands (\d (digit), \D (any…
Larsen: Ch. 10.1.2 RegEx (Lucy May)
Regular Expressions
powerful and flexible language for finding, replacing, or extracting content from text. You
RegEx language can be further used to specify the context in which a pattern exists (beginning of a line, end of a line, only as a stand-alone word, etc.).
Examples:
Predictable Formats
Phone Numbers
Emails
Commands
\d
digit
\D
any character, non-digit
\w
alphanumeric character
\W
non-alphanumeric character
.
any character
?
character directly preceding non necessary for a match
\s
white space
space, tab, new line
\S
anything but white space
[ ]
allows for specification of a list of allowable characters for a specific character position
ex/
[37]\d\d
[a-z}
^
anything but alphanumeric values listed
put in first inside position of a [
|
between 2 different patterns, either pattern will be selected
ex: 303|720
$
pattern must be adjacent to the end of the string being examined
*
zero or more repetitions
+
one or more repetitions
{m}
pattern preceding the curly brackets should repeat “m” times
{m,n}
pattern preceding the curly brackets should repeat “m” to “n” times
()
Capture the strings that fit the pattern