\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Nikolay Mishin (mishin)} \pdfinfo{ /Title (perl-regexp.pdf) /Creator (Cheatography) /Author (Nikolay Mishin (mishin)) /Subject (perl regexp Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A77AFF} \definecolor{LightBackground}{HTML}{F4EEFF} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{perl regexp Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Nikolay Mishin (mishin)} via \textcolor{DarkBackground}{\uline{cheatography.com/1008/cs/418/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Nikolay Mishin (mishin) \\ \uline{cheatography.com/mishin} \\ \uline{\seqsplit{mishin}.narod.ru} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 12th May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{20. Regular expression special variable}} \tn % Row 0 \SetRowColor{LightBackground} \$1, \$2, \$3 & hold the backreferences \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \$+ & holds the last (highest-numbered) backreference \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \$\& & (dollar ampersand) holds the entire regex match \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} \$' & (dollar followed by an apostrophe or single quote) holds the part of the string after (to the right of) the regex matc \tn % Row Count 10 (+ 4) % Row 4 \SetRowColor{LightBackground} \$` & (dollar backtick) holds the part of the string before (to the left of) the regex match \tn % Row Count 13 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{Using these variables is not recommended in perl scripts when performance matters, as it causes Perl to slow down all regex matches in your entire perl script.}}} \tn % Row Count 17 (+ 4) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\emph{All these variables are read-only, and persist until the next regex match is attempted.}}} \tn % Row Count 19 (+ 2) % Row 7 \SetRowColor{white} & \$string = "This is the geek stuff article for perl learner"; \tn % Row Count 21 (+ 2) % Row 8 \SetRowColor{LightBackground} & \$string =\textasciitilde{} /the (g.{\emph{) stuff(.}}) /; \tn % Row Count 23 (+ 2) % Row 9 \SetRowColor{white} & print "Matched String=\textgreater{}\$\&\textbackslash{}nBefore Match=\textgreater{}\$`\textbackslash{}nAfter Match=\textgreater{}\$'\textbackslash{}nLast Paren=\textgreater{}\$+\textbackslash{}nFirst Paren=\textgreater{}\$1\textbackslash{}n"; \tn % Row Count 27 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Debugging regexp}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{use re 'taint'; \newline % Row Count 1 (+ 1) \# Contents of \$match are tainted if \$dirty was also tainted. \newline % Row Count 3 (+ 2) (\$match) = (\$dirty =\textasciitilde{} /\textasciicircum{}(.*)\$/s); \newline % Row Count 4 (+ 1) \# Allow code interpolation: \newline % Row Count 5 (+ 1) use re 'eval'; \newline % Row Count 6 (+ 1) \$pat = '(?\{ \$var = 1 \})'; \# embedded code execution \newline % Row Count 8 (+ 2) /alpha\$\{pat\}omega/; \# won't fail unless under -T \newline % Row Count 10 (+ 2) \# and \$pat is tainted \newline % Row Count 12 (+ 2) use re 'debug'; \# like "perl -Dr" \newline % Row Count 13 (+ 1) /\textasciicircum{}(.*)\$/s; \# output debugging info during \newline % Row Count 15 (+ 2) \# compile time and run time \newline % Row Count 17 (+ 2) use re 'debugcolor'; \# same as 'debug', \newline % Row Count 19 (+ 2) \# but with colored output% Row Count 21 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \columnbreak \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{6 Regular Expressions}} \tn % Row 0 \SetRowColor{LightBackground} (\$var =\textasciitilde{} /re/), (\$var !\textasciitilde{} /re/) & matches / does not match \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{m/pattern/igmsoxc} & matching pattern \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} qr/pattern/imsox & store regex in variable \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{s/pattern/replacement/igmsoxe} & search and replace \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Modifiers:}}} \tn % Row Count 8 (+ 1) % Row 5 \SetRowColor{white} i case-insensitive & o compile once \tn % Row Count 10 (+ 2) % Row 6 \SetRowColor{LightBackground} g global & x extended \tn % Row Count 11 (+ 1) % Row 7 \SetRowColor{white} s as single line (. matches \textbackslash{}n) & e evaluate replacement \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Syntax:}}} \tn % Row Count 14 (+ 1) % Row 9 \SetRowColor{white} \textbackslash{} & escape \tn % Row Count 15 (+ 1) % Row 10 \SetRowColor{LightBackground} . & any single char \tn % Row Count 16 (+ 1) % Row 11 \SetRowColor{white} \textasciicircum{} & start of line \tn % Row Count 17 (+ 1) % Row 12 \SetRowColor{LightBackground} \$ & end of line \tn % Row Count 18 (+ 1) % Row 13 \SetRowColor{white} {\emph{, }}? & 0 or more times (greedy / nongreedy) \tn % Row Count 20 (+ 2) % Row 14 \SetRowColor{LightBackground} +, +? & 1 or more times (greedy / nongreedy) \tn % Row Count 22 (+ 2) % Row 15 \SetRowColor{white} ?, ?? & 0 or 1 times (greedy / nongreedy) \tn % Row Count 24 (+ 2) % Row 16 \SetRowColor{LightBackground} \textbackslash{}b, \textbackslash{}B & word boundary ( \textbackslash{}w - \textbackslash{}W) / match except at w.b. \tn % Row Count 27 (+ 3) % Row 17 \SetRowColor{white} \textbackslash{}A & string start (with /m) \tn % Row Count 28 (+ 1) % Row 18 \SetRowColor{LightBackground} \textbackslash{}Z & string end (before \textbackslash{}n) \tn % Row Count 29 (+ 1) % Row 19 \SetRowColor{white} \textbackslash{}z & absolute string end \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{6 Regular Expressions (cont)}} \tn % Row 20 \SetRowColor{LightBackground} \textbackslash{}G & continue from previous m//g \tn % Row Count 2 (+ 2) % Row 21 \SetRowColor{white} {[}...{]} & character set \tn % Row Count 3 (+ 1) % Row 22 \SetRowColor{LightBackground} (...) & group, capture to \$1, \$2 \tn % Row Count 5 (+ 2) % Row 23 \SetRowColor{white} (?:...) & group without capturing \tn % Row Count 7 (+ 2) % Row 24 \SetRowColor{LightBackground} \{n,m\} , \{n,m\}? & at least n times, at most m times \tn % Row Count 9 (+ 2) % Row 25 \SetRowColor{white} \{n,\} , \{n,\}? & at least n times \tn % Row Count 10 (+ 1) % Row 26 \SetRowColor{LightBackground} \{n\} , \{n\}? & exactly n times \tn % Row Count 11 (+ 1) % Row 27 \SetRowColor{white} | & or \tn % Row Count 12 (+ 1) % Row 28 \SetRowColor{LightBackground} \textbackslash{}1, \textbackslash{}2 & text from nth group (\$1, ...) \tn % Row Count 14 (+ 2) % Row 29 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{Escape Sequences:}}} \tn % Row Count 15 (+ 1) % Row 30 \SetRowColor{LightBackground} \textbackslash{}a alarm (beep) & \textbackslash{}e escape \tn % Row Count 16 (+ 1) % Row 31 \SetRowColor{white} \textbackslash{}f formfeed & \textbackslash{}n newline \tn % Row Count 17 (+ 1) % Row 32 \SetRowColor{LightBackground} \textbackslash{}r carriage return & \textbackslash{}t tab \tn % Row Count 19 (+ 2) % Row 33 \SetRowColor{white} \textbackslash{}cx control-x & \textbackslash{}l lowercase next char \tn % Row Count 20 (+ 1) % Row 34 \SetRowColor{LightBackground} \textbackslash{}L lowercase until \textbackslash{}E & \textbackslash{}U uppercase until \textbackslash{}E \tn % Row Count 22 (+ 2) % Row 35 \SetRowColor{white} \textbackslash{}Q diable metachars until \textbackslash{}E & \textbackslash{}E end case modifications \tn % Row Count 24 (+ 2) % Row 36 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Character Classes:}}} \tn % Row Count 25 (+ 1) % Row 37 \SetRowColor{white} {[}amy{]} & 'a', 'm', or 'y' \tn % Row Count 26 (+ 1) % Row 38 \SetRowColor{LightBackground} {[}f-j.-{]} & range f-j, dot, and dash \tn % Row Count 28 (+ 2) % Row 39 \SetRowColor{white} {[}\textasciicircum{}f-j{]} & everything except range f-j \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{6 Regular Expressions (cont)}} \tn % Row 40 \SetRowColor{LightBackground} \textbackslash{}d, \textbackslash{}D & digit {[}0-9{]} / non-digit \tn % Row Count 2 (+ 2) % Row 41 \SetRowColor{white} \textbackslash{}w, \textbackslash{}W & word char {[}a-zA-Z0-9\_{]} / non-word char \tn % Row Count 4 (+ 2) % Row 42 \SetRowColor{LightBackground} \textbackslash{}s, \textbackslash{}S & whitepace {[} \textbackslash{}t\textbackslash{}n\textbackslash{}r\textbackslash{}f{]} / non-space \tn % Row Count 6 (+ 2) % Row 43 \SetRowColor{white} \textbackslash{}C & match a byte \tn % Row Count 7 (+ 1) % Row 44 \SetRowColor{LightBackground} \textbackslash{}pP, \textbackslash{}PP & match p-named unicode / non-p-named-unicode \tn % Row Count 9 (+ 2) % Row 45 \SetRowColor{white} \textbackslash{}p\{...\}, \textbackslash{}P\{...\} & match long-named unicode / non-named-unicode \tn % Row Count 11 (+ 2) % Row 46 \SetRowColor{LightBackground} \textbackslash{}X & match extended unicode \tn % Row Count 12 (+ 1) % Row 47 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{Posix:}}} \tn % Row Count 13 (+ 1) % Row 48 \SetRowColor{LightBackground} {[}:alnum:{]} & alphanumeric \tn % Row Count 14 (+ 1) % Row 49 \SetRowColor{white} {[}:alpha:{]} & alphabetic \tn % Row Count 15 (+ 1) % Row 50 \SetRowColor{LightBackground} {[}:ascii:{]} & any ASCII char \tn % Row Count 16 (+ 1) % Row 51 \SetRowColor{white} {[}:blank:{]} & whitespace {[} \textbackslash{}t{]} \tn % Row Count 17 (+ 1) % Row 52 \SetRowColor{LightBackground} {[}:cntrl:{]} & control characters \tn % Row Count 18 (+ 1) % Row 53 \SetRowColor{white} {[}:digit:{]} & digits \tn % Row Count 19 (+ 1) % Row 54 \SetRowColor{LightBackground} {[}:graph:{]} & alphanum + punctuation \tn % Row Count 20 (+ 1) % Row 55 \SetRowColor{white} {[}:lower:{]} & lowercase chars \tn % Row Count 21 (+ 1) % Row 56 \SetRowColor{LightBackground} {[}:print:{]} & alphanum, punct, space \tn % Row Count 22 (+ 1) % Row 57 \SetRowColor{white} {[}:punct:{]} & punctuation \tn % Row Count 23 (+ 1) % Row 58 \SetRowColor{LightBackground} {[}:space:{]} & whitespace {[}\textbackslash{}s\textbackslash{}ck{]} \tn % Row Count 24 (+ 1) % Row 59 \SetRowColor{white} {[}:upper:{]} & uppercase chars \tn % Row Count 25 (+ 1) % Row 60 \SetRowColor{LightBackground} {[}:word:{]} & alphanum + '\_' \tn % Row Count 26 (+ 1) % Row 61 \SetRowColor{white} {[}:xdigit:{]} & hex digit \tn % Row Count 27 (+ 1) % Row 62 \SetRowColor{LightBackground} {[}:\textasciicircum{}digit:{]} & non-digit \tn % Row Count 28 (+ 1) % Row 63 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{{\bf{Extended Constructs}}} \tn % Row Count 29 (+ 1) % Row 64 \SetRowColor{LightBackground} (?\#text) & comment \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{6 Regular Expressions (cont)}} \tn % Row 65 \SetRowColor{LightBackground} (?imxs-imsx:...) & enable or disable option \tn % Row Count 2 (+ 2) % Row 66 \SetRowColor{white} (?=...), (?!...) & positive / negative look-ahead \tn % Row Count 4 (+ 2) % Row 67 \SetRowColor{LightBackground} (?\textless{}=..), (?\textless{}!..) & positive / negative look-behind \tn % Row Count 6 (+ 2) % Row 68 \SetRowColor{white} (?\textgreater{}...) & prohibit backtracking \tn % Row Count 7 (+ 1) % Row 69 \SetRowColor{LightBackground} (?\{ code \}) & embedded code \tn % Row Count 8 (+ 1) % Row 70 \SetRowColor{white} (??\{ code \}) & dynamic regex \tn % Row Count 9 (+ 1) % Row 71 \SetRowColor{LightBackground} (?(cond)yes|no) & condition corresponding to captured parentheses \tn % Row Count 12 (+ 3) % Row 72 \SetRowColor{white} (?(cond)yes) & condition corresponding to look-around \tn % Row Count 14 (+ 2) % Row 73 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Variables}}} \tn % Row Count 15 (+ 1) % Row 74 \SetRowColor{white} \$\& & entire matched string \tn % Row Count 16 (+ 1) % Row 75 \SetRowColor{LightBackground} \$` & everything prior to matched string \tn % Row Count 18 (+ 2) % Row 76 \SetRowColor{white} \$' & everything after matched string \tn % Row Count 20 (+ 2) % Row 77 \SetRowColor{LightBackground} \$1, \$2 ... & n-th captured expression \tn % Row Count 22 (+ 2) % Row 78 \SetRowColor{white} \$+ & last parenthesis pattern match \tn % Row Count 24 (+ 2) % Row 79 \SetRowColor{LightBackground} \$\textasciicircum{}N & most recently closed capt. \tn % Row Count 26 (+ 2) % Row 80 \SetRowColor{white} \$\textasciicircum{}R & result of last (?\{...\}) \tn % Row Count 28 (+ 2) % Row 81 \SetRowColor{LightBackground} @-, @+ & offsets of starts / ends of groups \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{6 Regular Expressions (cont)}} \tn % Row 82 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\seqsplit{http://perldoc.perl.org/perlrequick.html}} \tn % Row Count 1 (+ 1) % Row 83 \SetRowColor{white} \mymulticolumn{2}{x{5.377cm}}{\seqsplit{http://habrahabr.ru/post/17126/}} \tn % Row Count 2 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.9954 cm} x{3.9816 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{REGEX METACHARS}} \tn % Row 0 \SetRowColor{LightBackground} \textasciicircum{} & string begin \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \$ & str. end (before \textbackslash{}n) \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} + & one or more \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} * & zero or more \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} ? & zero or one \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \{3,7\} & repeat in range \tn % Row Count 6 (+ 1) % Row 6 \SetRowColor{LightBackground} () & capture \tn % Row Count 7 (+ 1) % Row 7 \SetRowColor{white} (?:) & no capture \tn % Row Count 8 (+ 1) % Row 8 \SetRowColor{LightBackground} {[}{]} & character class \tn % Row Count 9 (+ 1) % Row 9 \SetRowColor{white} | & alternation \tn % Row Count 10 (+ 1) % Row 10 \SetRowColor{LightBackground} \textbackslash{}b & word boundary \tn % Row Count 11 (+ 1) % Row 11 \SetRowColor{white} \textbackslash{}z & string end \tn % Row Count 12 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\seqsplit{http://perldoc.perl.org/perlre.html}} \tn % Row Count 13 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4977 cm} x{4.4793 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{REGEX MODIFIERS}} \tn % Row 0 \SetRowColor{LightBackground} /i & case insens. \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} /m & line based \textasciicircum{}\$ \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} /s & . includes \textbackslash{}n \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} /x & ign. wh.space \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} /g & global \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \textbackslash{}Q & quote (disable) pattern metacharacters till \textbackslash{}E \tn % Row Count 7 (+ 2) % Row 6 \SetRowColor{LightBackground} \textbackslash{}E & end either case modification or quoted section, think vi \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.38896 cm} x{2.58804 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{REGEX CHARCLASSES}} \tn % Row 0 \SetRowColor{LightBackground} . & {[}\textasciicircum{}\textbackslash{}n{]} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \textbackslash{}s & {[}\textbackslash{}x20\textbackslash{}f\textbackslash{}t\textbackslash{}r\textbackslash{}n{]} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \textbackslash{}w & {[}A-Za-z0-9\_{]} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \textbackslash{}d & {[}0-9{]} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \textbackslash{}S, \textbackslash{}W and \textbackslash{}D & negate \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}