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 with Ruby
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Elle Meredith
April 03, 2014
Technology
200
1
Share
Regular Expressions with Ruby
What Do You Know? Sydney, 03 April, 2014
Elle Meredith
April 03, 2014
More Decks by Elle Meredith
See All by Elle Meredith
Exploring anti-patterns in Rails
aemeredith
3
310
Strategies for saying no
aemeredith
1
200
Start your own apprenticeship program
aemeredith
0
290
Story-telling with Git rebase
aemeredith
1
1.6k
Algorithms to live by and why should we care
aemeredith
0
760
Feedback matters
aemeredith
0
400
Two heads are better than one
aemeredith
2
1.7k
Feedback Matters
aemeredith
0
430
How I Learn
aemeredith
0
570
Other Decks in Technology
See All in Technology
Tour of Agent Protocols: MCP, A2A, AG-UI, A2UI with ADK
meteatamel
1
220
TanStack Start エコシステムの現在地 / TanStack Start Ecosystem 2026
iktakahiro
1
350
ストライクウィッチーズ2期6話のエイラの行動が許せないのでPjMの観点から何をすべきだったのかを考える
ichimichi
1
290
2026-04-02 IBM Bobオンボーディング入門
yutanonaka
0
250
プロダクトを育てるように生成AIによる開発プロセスを育てよう
kakehashi
PRO
1
850
Network Firewall Proxyで 自前プロキシを消し去ることができるのか
gusandayo
0
210
ASTのGitHub CopilotとCopilot CLIの現在地をお話しします/How AST Operates GitHub Copilot and Copilot CLI
aeonpeople
1
200
Databricks Appsで実現する社内向けAIアプリ開発の効率化
r_miura
0
340
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
AIにより大幅に強化された AWS Transform Customを触ってみる
0air
0
330
推し活エージェント
yuntan_t
1
870
ある製造業の会社全体のAI化に1エンジニアが挑んだ話
kitami
2
160
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.4k
Building the Perfect Custom Keyboard
takai
2
720
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.3k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
470
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
130
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
95
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
160
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Discover your Explorer Soul
emna__ayadi
2
1.1k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
250
Transcript
Regular Expressions with Ruby Elle Meredith – @aemeredith
Test Extract Change
/fox/ =~ "The quick brown fox" Basic Matching
/fox/ =~ "The quick brown fox" => 16 Basic Matching
/cat/ =~ "The quick brown fox" => nil Basic Matching
/cat/ !~ "The quick brown fox" => true Basic Matching
MatchData string = "The quick brown fox jumps over the
lazy dog”
MatchData string = "The quick brown fox jumps over the
lazy dog” ! matchdata = string.match /fox/ => #<MatchData "fox">
MatchData matchdata.to_s => "fox"
MatchData matchdata.pre_match => "The quick brown "
MatchData matchdata.post_match => " jumps over the lazy dog"
Captures string = "03APR2014" ! string.match /\D{3}/
Captures string = "03APR2014" ! string.match /\D{3}/
Captures string = "03APR2014" ! string.match /\D{3}/
Captures string = "03APR2014" ! string.match /\D{3}/ => #<MatchData "APR">
Captures md = string.match /(.*)(\D{3})(.*)/
Captures md = string.match /(.*)(\D{3})(.*)/
Captures md = string.match /(.*)(\D{3})(.*)/
Captures md = string.match /(.*)(\D{3})(.*)/ => #<MatchData "03APR2014" 1:"03" 2:"APR"
3:"2014">
Captures md.captures => ["03", "APR", "2014"]
Captures md = string.match /(.*)(\D{3})(.*)/ => #<MatchData "03APR2014" 1:"03" 2:"APR"
3:"2014">
Captures md[1] => "03" md[2] => "APR" md[3] => "2014"
Named Captures md = string.match /(?<day>.*)(? <month>\D{3})(?<year>.*)/ => #<MatchData "03APR2014"
day:"03" month:"APR" year:"2014">
Named Captures md = string.match /(?<day>.*)(? <month>\D{3})(?<year>.*)/ => #<MatchData "03APR2014"
day:"03" month:"APR" year:"2014">
Named Captures md = string.match /(?<day>.*)(? <month>\D{3})(?<year>.*)/ => #<MatchData "03APR2014"
day:"03" month:"APR" year:"2014">
Named Captures md = string.match /(?<day>.*)(? <month>\D{3})(?<year>.*)/ => #<MatchData "03APR2014"
day:"03" month:"APR" year:"2014">
Named Captures md['day'] => "03"
Look Around string = ''' I love my job, I
love the pay! I love it more and more each day. I love my boss, he is the best! I love his boss and all the rest. '''
Look Around string.scan /love my/ => ["love my", "love my”]
Positive Lookahead string.scan /love my (?=job)/ => ["love my "]
Changing things string.gsub(/love/, 'hate')
Changing things string.gsub(/love/, 'hate') => "\nI hate my job, I
hate the pay! \nI hate it more and more each day.\nI hate my boss, he is the best!\nI hate his boss and all the rest.\n"
Changing things string.gsub!(/\she/, ' she').gsub!(/ his/, 'her')
Changing things string.gsub!(/\she/, ' she').gsub!(/ his/, 'her')
Changing things string.gsub!(/\she/, ' she').gsub!(/ his/, ‘her') => "\nI love
my job, I love the pay! \nI love it more and more each day. \nI love my boss, she is the best!\nI love her boss and all the rest.\n"
None
Regular Expressions with Ruby Elle Meredith – @aemeredith