This commit is contained in:
Mark 2023-02-03 13:19:19 -08:00
parent 4bb7cd7c5d
commit 9653f103dc

View File

@ -18,12 +18,12 @@
{The Regex Warm-Up}
{Prepared by Mark on \today}
Yesterday we discussed Deterministic Finite Automata. One interesting application of these mathematical objects is pattern matching, usually in the form of Regular Expressions. \\
Last time, we discussed Deterministic Finite Automata. One interesting application of these mathematical objects is pattern matching, usually in the form of Regular Expressions. \\
(abbreviated \say{regex}, which is pronounced like \say{gif})
\vspace{2mm}
Regex is a language used to specify patterns in a string. You can think it as a concise way to define a DFA, using text instead of a huge graph. \\
Regex is a language used to specify patterns in a string. You can think of it as a concise way to define a DFA, using text instead of a huge graph. \\
Often enough, a clever regex pattern can do the work of a few hundred lines of code. \\
@ -55,7 +55,7 @@
\htexttt{?} means \say{match one or none of the preceeding token} \\
The pattern \htexttt{linea?r} will match only \texttt{linear} and \texttt{liner} \\
The pattern \htexttt{linea?r} will match only \texttt{linear} and \texttt{liner}. \\
\vspace{2mm}
Brackets \htexttt{\{min, max\}} are the most flexible quantifier. \\
@ -127,7 +127,7 @@
\texttt{[a-z]} will only match lowercase letters.}
\item A word with exactly 3 vowels. \\
\hint{The special token \texttt{\textbackslash w} will match any word character. It is equivalent to \texttt{[A-z0-9\_]}}
\hint{The special token \texttt{\textbackslash w} will match any word character. It is equivalent to \texttt{[A-z0-9\_]} \\ \texttt{\_} stands for a literal underscore.}
\item A word that has even length and exactly 3 vowels.
@ -143,6 +143,6 @@
\problem{}
If you'd like to know more, check out \texttt{regexr.com}. It offers an interative regex prompt, as well as a cheatsheet that explains every other regex token there is. You can find a nice set of challenges at \texttt{http://regex.alf.nu}. \\
If you'd like to know more, check out \texttt{regexr.com}. It offers an interative regex prompt, as well as a cheatsheet that explains every other regex token there is. You will find a nice set of challenges at \texttt{http://regex.alf.nu}. \\
I especially encourage you to look into this if you are interested in computer science.
\end{document}