Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
UBC STAT545 2015 cm103: Introduction to Regular...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kieran Samuk
October 29, 2015
Education
0
970
UBC STAT545 2015 cm103: Introduction to Regular Expressions
One part of a STAT545 lecture from 2015.
Kieran Samuk
October 29, 2015
Tweet
Share
More Decks by Kieran Samuk
See All by Kieran Samuk
Incipient speciation without trophic specialization in the white stickleback
ksamuk
0
38
Natural selection and diversification in the threespine stickleback
ksamuk
0
190
Gene flow favors clustering of adaptive alleles in a globally distributed species
ksamuk
0
87
Other Decks in Education
See All in Education
2025-10-30 社会と情報2025 #05 CC+の代わり
mapconcierge4agu
0
110
2025-12-11 nakanoshima.dev LT
takesection
0
110
コマンドラインを見直そう(1995年からタイムリープ)
sapi_kawahara
0
660
20251119 如果是勇者欣美爾的話, 他會怎麼做? 東海資工
pichuang
0
170
AIで日本はどう進化する? 〜キミが生きる2035年の地図〜
behomazn
0
120
1202
cbtlibrary
0
210
ロータリー国際大会について~国際大会に参加しよう~:古賀 真由美 会員(2720 Japan O.K. ロータリーEクラブ・(有)誠邦産業 取締役)
2720japanoke
1
770
Semantic Web and Web 3.0 - Lecture 9 - Web Technologies (1019888BNR)
signer
PRO
2
3.2k
焦りと不安を、技術力に変える方法 - 新卒iOSエンジニアの失敗談と成長のフレームワーク
hypebeans
1
650
Flinga
matleenalaakso
3
15k
Generative AI Leader 認定試験範囲の解説
cloudace
0
100
Web 2.0 Patterns and Technologies - Lecture 8 - Web Technologies (1019888BNR)
signer
PRO
0
3k
Featured
See All Featured
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
110
Leo the Paperboy
mayatellez
4
1.4k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
Six Lessons from altMBA
skipperchong
29
4.2k
Utilizing Notion as your number one productivity tool
mfonobong
3
220
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
96
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
140
Building AI with AI
inesmontani
PRO
1
700
How to Ace a Technical Interview
jacobian
281
24k
How STYLIGHT went responsive
nonsquared
100
6k
The Language of Interfaces
destraynor
162
26k
Visualization
eitanlees
150
17k
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