% lecture "Regular Expressions - an introduction -"
% (c) 2001 by Andreas Romeyke
% can be used and is distributed under the terms of Gnu General Public License
\documentclass[english,portrait,a4, slidesonly]{seminar} %notes, notesonly, slidesonly
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{fancybox}
\usepackage{babel}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}
\usepackage{amssymb}
\makeatletter
\usepackage{verbatim}
\geometry{verbose,a4paper,bmargin=2.5cm}
\newcommand{\mydate}{%
    Leipzig, January 16th 2001
}%
%\twoup[-8]
\renewcommand{\slidebottommargin}{2.5cm}
\slideframe{oval}
\newpagestyle{327}%
  {{\tiny Regular Expressions,  \mydate} \hspace{\fill}\rightmark}
  {
    \emph{
	{\tiny\copyright 2001 by Andreas Romeyke}
    }
    \hspace{\fill}
    \thepage
    }%
\pagestyle{327}
\makeatother
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{Goals}
\title{Regular Expressions\\
- an introduction -}
\author{Andreas Romeyke}
\date{\mydate}
\maketitle
{\small
The presentation is a very small introduction into Regular Expressions
because the presentation time is only about 10 minutes.\\
The presentation should be an appetizer to learn more about perl, macro-processing
and of course unix-derivates.
}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\begin{note}
\begin{itemize}
\item greeting
\item name
\item length of presentation
\item questions
\end{itemize}
\end{note}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{Contents}
\tableofcontents{}
\end{slide*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\section{What are Regular Expressions?}
\markright{What...}
Regular Expressions are:
\begin{itemize}
\item search patterns
\item template masks
\item text manipulation filters
\end{itemize}
\begin{itemize}
\item finate state machines
\end{itemize}
\begin{itemize}
\item LEGO\texttrademark*-bricks
\end{itemize}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\begin{note}
\begin{description}
\item [search patterns] to substitute text with others
\item [finate state machines] the mechanism in background
\item [LEGO\texttrademark*-bricks] simple to use, modular now
\end{description}
\end{note}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{Where...}
\section{Where are Regular Expressions useful?}
RegEx are parts in:
\begin{itemize}
\item texteditors, word processors
\end{itemize}
\begin{itemize}
\item databases
\end{itemize}
\begin{itemize}
\item search engines
\end{itemize}
\begin{itemize}
\item language translators, compiler, interpreter
\end{itemize}
\begin{itemize}
\item operating system command shells
\end{itemize}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\begin{note}
\begin{description}
\item [texteditors, word processors] as a text search and replace tool
\item [databases] to reduce datasize, to mask needed results
\item [search engines] a comfortable way to find the right sites
\item [language translators, compiler, interpreter] is this a comment or a keyword?
\item [operating system command shells]I need a list of all my files in my home-directory 
\end{description}
\end{note}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{How... Intro}
\section{How can Regular Expressions used?}
\subsection{Introduction}
A RegEx has the components:
\begin{itemize}
\item patterns
\item quantifiers
\item anchors
\end{itemize}

There are also additional unimportant components:
\begin{itemize}
\item buffers %brackets and \1 
\item classificators %\d as a number
\item area controller %look ahead
\end{itemize}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{slide*}[7in,6in]
\markright{How... Intro}

\begin{itemize}
\item simplest RegEx: 
\end{itemize}
{\footnotesize
\begin{quotation}
{}``stop{}'' \( \rightarrow  \) \emph{{}``non}\textbf{\emph{stop}}\emph{{}''}
\end{quotation}
}
\begin{itemize}
\item 'everybody knows about it'-RegEx:
\end{itemize}
{\footnotesize
\begin{quotation}
\begin{tabular}{ccc}
&
&
\emph{{}``test.bat{}''}\\
{}``{*}.exe{}''&
\( \rightarrow  \)&
\emph{{}``}\textbf{\emph{test.exe}}\emph{{}''}\\
&
&
\emph{{}``test.png{}''}\\
\end{tabular}
\end{quotation}
}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{How... Intro}
\begin{itemize}
\item a noisy RegEx:
\end{itemize}
{\footnotesize
\begin{quotation}
{}``\textasciicircum{}\( \left[ \right.  \)\textasciicircum{} \( \left. \right]  \)+s.?-{*}\${}''
\( \rightarrow  \) {}``\textbf{\emph{gws3-}}{}``
\end{quotation}
}
\begin{quote}
Explanation: A string beginning with a subset of chars (one or more)
which are non-spaces followed by any kind of char and at the end a
minus or not.
\end{quote}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{How... Patterns}
\subsection{Patterns}

A pattern can be:
\begin{itemize}
\item a char or a symbol
\item a group of symbols (string)
\item a class of symbols
\end{itemize}
a subexpression means a pattern
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{How... Patterns}

\begin{itemize}
\item a group of symbols is enclosed in brackets:
{\footnotesize
\begin{quotation}
``\( \left(symbol\right) \)'' \( \rightarrow \) groups to string ``symbol''
\end{quotation}
}
\end{itemize}
\begin{itemize}
\item a class of symbols is enclosed in squared brackets:
{\footnotesize
\begin{quotation}
``\( \left[symbol\right] \)'' \( \rightarrow \) generates a class to 
\end{quotation}
\begin{quotation}
match on `s', `y', `m', `b',`o' or `l'
\end{quotation}
}
\end{itemize}

\begin{itemize}
\item a class can be negated with a circumflex:
{\footnotesize
\begin{quotation}
``\( \left[\textasciicircum{}symbol\right] \)'' \( \rightarrow \) generates a class which 
\end{quotation}
\begin{quotation}
never matches `s', `y', `m', `b',`o' or `l'
\end{quotation}
}
\end{itemize}
\begin{itemize}
\item a group of patterns or expressions is enclosed in brackets:
{\footnotesize
\begin{quotation}
``\( \left(sym\left[bol\right]\right) \)'' \( \rightarrow \) groups to 
\end{quotation}
\begin{quotation}
expressions ``symb'',``symo'',``syml'' 
\end{quotation}
}
\end{itemize}

\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{How... Quantifiers}
\subsection{Quantifiers}
\begin{description}
\item [{*}]no subexpression or one and more subexpressions
\item [+]one and more subexpression
\item [?]no subexpression or only one
\item [\( \left\{ 2\right\}  \)]only two subexpression (not less nor more)
\item [\( \left\{ 2,\right\}  \)]two and more subexpressions
\item [\( \left\{ 2,5\right\}  \)]two up to five subexpressions
\item [\( \left\{ ,5\right\}  \)]no or one up to five subexpressions
\end{description}
Example:{\footnotesize
\begin{quotation}
{}``12?{}'' \( \rightarrow  \) {}``\emph{0}\textbf{\emph{1}}\emph{1}{}''
or {}``\emph{0}\textbf{\emph{12}}{}'', not {}``\emph{122}{}''
\end{quotation}
}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{How... Anchors}
\subsection{Anchors}
\begin{description}
\item [\textasciicircum{}]marks the string-start
\item [\$]marks the string-end
\end{description}
Example:{\footnotesize
\begin{quotation}
{}``\textasciicircum{}script{}'' \( \rightarrow  \){}``\textbf{\emph{script}}\emph{um}{}'',
not {}``\emph{postscript}{}''

{}``tum\${}'' \( \rightarrow  \){}``\emph{scrip}\textbf{\emph{tum}}{}'',
not {}``\emph{tumbre}{}''

{}``\textasciicircum{}script{}'' \( \rightarrow  \){}``\textbf{\emph{script}}{}'',
not {}``\emph{postscriptum}{}''

{}``script{}'' \( \rightarrow  \){}''\emph{post}\textbf{\emph{script}}\emph{um}{}''
\end{quotation}
}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{What next?}
\section{What next?}
Do you like Regular Expressions?
Then check:
\begin{itemize}
\item Perl - it is a crazy and powerfull scripting language %(also seen on MS Windows\texttrademark)
\item grep - it is a little tool to find specific strings in textfiles
\item fireball - it is regexified Internet search engine
\end{itemize}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide*}[7in,6in]
\markright{Lecture}
\section*{Lecture}
\begin{itemize}
\item Friedl, Jeffrey E. F.:Mastering Regular Expressions; O'Reilly \& Associates, Inc; 1998
\item Schwartz, Randal L.; Christiansen, Tom:Learning Perl, Second Edition; O'Reilly \& Associates, Inc;1997
\item http://perl.com
\item http://gaos.org/
\item http://art1.it-netservice.de
\end{itemize}
\end{slide*}
\begin{slide*}[7in,6in]
\markright{Thanks}
\section*{Thanks}
Thanks to
\begin{itemize}
\item Donald E. Knuth for his excellent \TeX \\ and the Community for their \LaTeX-- extensions
\item Walter Schmidt \& co. for their good \LaTeX2\(\varepsilon\) documentation
\item Larry Wall and the Community for their practical extraction and report language (Perl)
\item my wife and my daughter for their time
\end{itemize}
\end{slide*}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}

