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
Regular Expressions Basics Lesson for Ada Academy
Search
nellshamrell
September 26, 2014
Technology
54
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Regular Expressions Basics Lesson for Ada Academy
nellshamrell
September 26, 2014
Other Decks in Technology
See All in Technology
「事実」を「計測」して、「解釈」する 〜AWS Lambdaのメモリ最適解の見つけ方〜
maimyyym
0
170
Kiro Crewをはじめよう
kizawa2020
1
160
Rustuna: Rustによる高速なOptuna実装
pfn
PRO
0
190
分析AIエージェントを育てる、動く環境を育てる
codatum
1
1.1k
1つのリクエストを追って理解する - llm-dのP/D分離
akhino
1
160
AIカンパニーへの転換を支えた、エンジニアの仕事の再定義
kworkdev
PRO
2
1.2k
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
7
6k
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.6k
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
150
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
継続的なAIコスト最適化
bgpat
1
340
WasmをRustにする
sansantech
PRO
0
250
Featured
See All Featured
Evolving SEO for Evolving Search Engines
ryanjones
0
330
Into the Great Unknown - MozCon
thekraken
41
2.8k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
440
Optimizing for Happiness
mojombo
378
71k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Building AI with AI
inesmontani
PRO
1
1.3k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
The SEO identity crisis: Don't let AI make you average
varn
0
590
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
580
Transcript
REGULAR EXPRESSIONS Nell Shamrell @nellshamrell
What is a regular expression? It’s a pattern.
How do you make a regular expression? /RegularExpression/
What can you do with a regular expression?
Test Extract Change
Test Extract Change
Test Extract Change
Testing a String
“Use the force”
/force/ “Use the force”
=~
/force/ =~ “Use the force”
“Use the force” =~ /force/
/force/ =~ “Use the force” => 8
/dark side/ !~ “Use the force”
/dark side/ !~ “Use the force” => true
MatchData
match
string = “The force will be with you always.”
string = “The force will be with you always.” m
= /force/.match(string)
string = “The force will be with you always.” m
= /force/.match(string) => #<MatchData “force” >
What can you do with MatchData?
m = /force/.match(string)
m = /force/.match(string) m.to_s
m = /force/.match(string) m.to_s => “force”
m = /force/.match(string)
m = /force/.match(string) m.pre_match
m = /force/.match(string) m.pre_match => “The ”
m = /force/.match(string)
m = /force/.match(string) m.post_match
m = /force/.match(string) m.post_match => “ will be with you
always ”
Email Validation
[email protected]
Rubular
Alternation /nell | renee /
. * any single character character can appear any number
of times
/.*/ Matches ANYTHING
Range [a-d] [1-4]
\w stands for any word character same as [a-zA-Z0-9_]
+ character must appear one or more times
None
Extracting Strings
\d stands for any digit same as [0-9]
\d{3} looks for exactly 3 digits
? makes a character optional
Changing a String
string = “Renee is presenting to the class right now.
Renee is presenting on regular expressions.”
sub(/regex/, “text”)
string = “Renee is presenting to the class right now.
Renee is presenting on regular expressions.”
string = “Renee is presenting to the class right now.
Renee is presenting on regular expressions.” new = string.sub(/Renee/, “Nell”)
new = string.sub(/Renee/, “Nell”) => “Nell is presenting to the
class right now. Renee is presenting on regular expressions.”
gsub(/regex/, “text”)
new = string.gsub(/Renee/, “Nell”)
=> “Nell is presenting to the class right now. Nell
is presenting on regular expressions.” new = string.gsub(/Renee/, “Nell”)
string.gsub!(/Renee/, “Nell”)
Welcome to the world of regular expressions!
https://gist.github.com/ nellshamrell/6938008 Resources
Contact Info Nell Shamrell @nellshamrell
[email protected]