Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
UBC STAT545 2015 cm103: Introduction to Regular...
Search
Kieran Samuk
October 29, 2015
Education
980
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
UBC STAT545 2015 cm103: Introduction to Regular Expressions
One part of a STAT545 lecture from 2015.
Kieran Samuk
October 29, 2015
More Decks by Kieran Samuk
See All by Kieran Samuk
Incipient speciation without trophic specialization in the white stickleback
ksamuk
0
56
Natural selection and diversification in the threespine stickleback
ksamuk
0
200
Gene flow favors clustering of adaptive alleles in a globally distributed species
ksamuk
0
110
Other Decks in Education
See All in Education
Science Tokyo University for International Research Excellence scheme_April 2026
sciencetokyo
PRO
0
250
sepm-training-sample
levii
0
250
Examen de Selectividad. Geografía julio 2026 (Convocatoria Extraordinaria). UCLM
juanmartin2026
1
13k
輻射安全管理系統2.0暨輻防e++學園平台說明會
aecrp
0
2.1k
人間のために、人間と共に働く時代の終わりの始まり
frievea
0
190
[2026前期火5] 論理学(京都大学文学部 前期 第11回)「ハーモニー:三層モデルと保存拡大」
yatabe
0
290
iSpindel & AI
lonbrew
0
110
Visionary Initiative: Future Intelligence — Laying the foundations for the future of science, intelligence, and society | Science Tokyo
sciencetokyo
PRO
0
340
「答えを出す」より「わかる」をつくる
kzkmaeda
1
300
Tema 1. El relieve de España: Formación y características
juanmartin2026
0
25k
Geografía y fútbol. Atlanta. la megalópolis del fútbol
juanmartin2026
1
12k
CLASSIFICATION OF CRUDE DRUGS
pawan_pharm
0
190
Featured
See All Featured
How to make the Groovebox
asonas
2
2.4k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Making Projects Easy
brettharned
120
6.8k
Technical Leadership for Architectural Decision Making
baasie
3
580
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
290
Evolving SEO for Evolving Search Engines
ryanjones
0
300
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
76k
Mobile First: as difficult as doing things right
swwweet
225
10k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
580
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Design in an AI World
tapps
1
330
Transcript
Regular Expressions & Character Data in R Kieran Samuk for
STAT545
Outline 1. Regular expression basics 2. Regular expressions & character
data in R
Outline 1. Regular expression basics 2. Regular expressions & character
data in R
Regular expressions (“regex”) Coded representations of patterns in text
Regex is (mostly) universal Not limited to a specific programming
language
Insanely useful for… Filtering Finding and replacing Validating input Counting
occurrences Mining text
Regex Anatomy ^[Hh]e walked [0-9]* meters$
Regex Anatomy ^[Hh]e walked [0-9]* meters$ “Literals” “Metacharacters” Normal letters
and digits (+ spaces) Special characters with regex specific functions
Regex Anatomy ^[Hh]e walked [0-9]* meters$ “Literals” “Metacharacters” Normal letters
and digits (+ spaces) Special characters with regex specific functions
Go to https://regex101.com/r/gZ2uW4/2
Literals All literals match themselves, and only themselves
Metacharacters: Groups and Ranges . Any character [AaBb] A or
a or B or b [A-Z] A or B or C, … Z [0-9] 0 or1 or 2, … 9 [^A-Z] Everything but capitals (it|the) “it” OR “the”
Metacharacters: Quantifiers * Zero or more times + One or
more times ? Zero or one times {3} Exactly 3 times {1,3} 1 to 3 times {3,} 3 or more times
Metacharacters: Other ^ Start of a string $ End of
a string \ Escape (meta to literal) \w, \W [A-Za-z0-9], [^A-Za-z0-9] \d, \D [0-9], [^0-9] \s, \S Whitespace (space, tab, newline, carriage return, etc.) + not
Metacharacters: Other ^ Start of a string $ End of
a string \ Escape (meta to literal) \w, \W [A-Za-z0-9], [^A-Za-z0-9] \d, \D [0-9], [^0-9] \s, \S Whitespace (space, tab, newline, carriage return, etc.) + not
Regex Challenges! RULES 1. Match ONLY the target elements 2.
Each discrete item must be a separate match 3. THERE ARE CANDY PRIZES 1. DNA sequences 2. Email addresses 3. Smilies 4. HTML Tags (each tag separately) 5. Phone numbers 6. URLs 7. Macho Man Randy Savage Quotations 9. Citations
Notes Only a glimpse of regex! Lots of resources on
the web
Outline 1. Regular expression basics 2. Regular expressions & character
data in R
Outline 1. Regular expression basics 2. Regular expressions & character
data in R