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
Introduction to Regular Expression
Search
N@N
September 21, 2013
Technology
350
0
Share
Introduction to Regular Expression
姫路IT系勉強会 Vol.20で発表した内容に加筆・修正を加えたものです.
N@N
September 21, 2013
More Decks by N@N
See All by N@N
introduction to modern numerical analysis
spark6251
0
190
Finite Automaton equivalents to Regular Expression
spark6251
0
140
Programmer and English
spark6251
0
120
Let's go to the study session
spark6251
0
110
Quantum Computation
spark6251
0
270
Introduction to use Grunt
spark6251
0
99
Introduction to SCSS+COMPASS
spark6251
0
300
Introduction to Psychology
spark6251
1
290
Introduction to HTML5
spark6251
0
320
Other Decks in Technology
See All in Technology
小説執筆のハーネスエンジニアリング
yoshitetsu
0
740
Do Vibe Coding ao LLM em Produção para Busca Agêntica - TDC 2026 - Summit IA - São Paulo
jpbonson
3
140
インターネットの技術 / Internet technology
ks91
PRO
0
210
AgentCore Managed Harness を使ってみよう
yakumo
2
130
EBS暗号化に失敗してEC2が動かなくなった話
hamaguchimmm
2
210
AI時代のガードレールとしてのAPIガバナンス
nagix
0
300
No Types Needed, Just Callable Method Check
dak2
1
1.5k
マルチプロダクトの信頼性を効率良く保っていくために
kworkdev
PRO
0
170
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
1
270
Percolatorを廃止し、マルチ検索サービスへ刷新した話 / Search Engineering Tech Talk 2026 Spring
visional_engineering_and_design
0
100
AI와 협업하는 조직으로의 여정
arawn
0
500
マルチエージェント × ハーネスエンジニアリング × GitLab Duo Agent Platformで実現する「AIエージェントに仕事をさせる時代へ。」 / 20260421 GitLab Duo Agent Platform
n11sh1
0
170
Featured
See All Featured
So, you think you're a good person
axbom
PRO
2
2k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Statistics for Hackers
jakevdp
799
230k
Heart Work Chapter 1 - Part 1
lfama
PRO
6
35k
Are puppies a ranking factor?
jonoalderson
1
3.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
How to Ace a Technical Interview
jacobian
281
24k
Six Lessons from altMBA
skipperchong
29
4.2k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
680
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
190
Transcript
None
• • • • •
• • • • •
• •
• • • •
• . • • • •
• • •
• • • •
• • • • $ egrep [option] 'regex' file1 file2...
• $ egrep '[0-9]{3}-?[0-9]{4}' file01 • 1000 14 • validator
• Number::ZipCode::JP
• • • • •
• ^ • • '^cat' • •
• $ • • 'cat$' • •
• '^$' • • • '^cat$' • •
• '^' • • • '$' • •
• [...] • • 'gr[ae]y' • • •
• • '[0123456789]' = '[0-9]' • '[ABCDE...Z]' = '[A-Z]' •
'[abcde...z]' = '[a-z]' • '[012...9ABCDEFabcdef]' = '[0-9A-Fa-f]' • • [Ss]mith' blacksmith
• [^...] • • • '[^0-9]' • •
• $ egrep 'A[^B]' file01 • • •
• . • • 'A.B' •
• | • • 'gr[ae]y' = 'gr(a|e)y' = 'gray|grey' •
'gra|ey' gra ey • '[a|e]' a | e
• • • $ egrep -i 'from|to' file = $
egrep '[Ff][Rr][Oo][Mm]|[Tt][Oo]' file
• ¥<string¥> • egrep • the quick brown_ fox's $190.3?
$!?. •
• ? • • • • 'colou?r' • • '1st|1'
= '1(st)?'
• + • • * • • 'A+' = 'AA*'
• 'AA*' ≠ '(AA)*'
• ¥char • • '¥.' •
^ $ . [ABC] [^ABC] [A-Z] [^A-Z] c1|c2
+ * ? {n} {n,} {,m} {n,m} () ¥char
• • • • •
•
• •
• m • m/regex/mods • • s/regex/replacement/mods • • value
=~ /regex/mods • •
• /i • /x • /g
• • • ¥<(.*?)>.*?</¥1>¥ • <a>sdad</a> <list>dfasj</list>
• if($str =~ /(.*)?/) { print $1; # () }
$ perl [option] '[perlScript]' file01 • -e • -n 1
• -p • -l • -i
$ perl -i'*.back' -e '[perlScript]' file
$ find . -type f -print0 | xargs -0 sed
-i -e 's/foo/bar/g' $ git grep -l 'foo' | xargs -0 sed -i -e 's/foo/bar/g' $ git ls-files -z | xargs -0 sed -i -e 's/foo/bar/g'
• • • •
•
• • • •
• • • •
• • • •
• • • •
• • • • •
None
• • • •
• • • • • • • •
• • • • • • •
• • • • • • •
• • • •
None
• • • •
• • • • •
None
• • •
None
• •
None
• •
• •
• •
None
• •
• •
• • • • • • •
• • • •
• 'nfa|nfa not' • •
• 'X(.+)+X' • • • •
• • 'a.*b'
• • '^.*' •
• • 'to(nite|knight|night)' • •
• • • 'to(nite|knight|night)'
• • • • • •
• • • •
• • • •
• •
• • • • • •
None