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
Regular Expressions Basics Lesson for Ada Academy
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
nellshamrell
September 26, 2014
Technology
0
46
Regular Expressions Basics Lesson for Ada Academy
nellshamrell
September 26, 2014
Tweet
Share
Other Decks in Technology
See All in Technology
ブロックテーマでサイトをリニューアルした話 / 2026-01-31 Kansai WordPress Meetup
torounit
0
470
Claude_CodeでSEOを最適化する_AI_Ops_Community_Vol.2__マーケティングx_AIはここまで進化した.pdf
riku_423
2
600
Frontier Agents (Kiro autonomous agent / AWS Security Agent / AWS DevOps Agent) の紹介
msysh
3
180
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
650
Tebiki Engineering Team Deck
tebiki
0
24k
2026年、サーバーレスの現在地 -「制約と戦う技術」から「当たり前の実行基盤」へ- /serverless2026
slsops
2
260
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.4k
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
200
プロポーザルに込める段取り八分
shoheimitani
1
470
SRE Enabling戦記 - 急成長する組織にSREを浸透させる戦いの歴史
markie1009
0
130
Featured
See All Featured
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
350
Code Review Best Practice
trishagee
74
20k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
280
Chasing Engaging Ingredients in Design
codingconduct
0
110
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
310
Optimizing for Happiness
mojombo
379
71k
Statistics for Hackers
jakevdp
799
230k
How to Ace a Technical Interview
jacobian
281
24k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
260
My Coaching Mixtape
mlcsv
0
48
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]