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
0
340
Introduction to Regular Expression
姫路IT系勉強会 Vol.20で発表した内容に加筆・修正を加えたものです.
N@N
September 21, 2013
Tweet
Share
More Decks by N@N
See All by N@N
introduction to modern numerical analysis
spark6251
0
180
Finite Automaton equivalents to Regular Expression
spark6251
0
140
Programmer and English
spark6251
0
120
Let's go to the study session
spark6251
0
100
Quantum Computation
spark6251
0
270
Introduction to use Grunt
spark6251
0
94
Introduction to SCSS+COMPASS
spark6251
0
290
Introduction to Psychology
spark6251
1
270
Introduction to HTML5
spark6251
0
300
Other Decks in Technology
See All in Technology
Ruby版 JSXのRuxが気になる
sansantech
PRO
0
140
Azure Durable Functions で作った NL2SQL Agent の精度向上に取り組んだ話/jat08
thara0402
0
160
2026年、サーバーレスの現在地 -「制約と戦う技術」から「当たり前の実行基盤」へ- /serverless2026
slsops
2
220
Agile Leadership Summit Keynote 2026
m_seki
1
560
GitLab Duo Agent Platform × AGENTS.md で実現するSpec-Driven Development / GitLab Duo Agent Platform × AGENTS.md
n11sh1
0
130
データ民主化のための LLM 活用状況と課題紹介(IVRy の場合)
wxyzzz
2
690
Introduction to Bill One Development Engineer
sansan33
PRO
0
360
2人で作ったAIダッシュボードが、開発組織の次の一手を照らした話― Cursor × SpecKit × 可視化の実践 ― Qiita AI Summit
noalisaai
1
380
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
180
入社1ヶ月でデータパイプライン講座を作った話
waiwai2111
1
270
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
17k
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
440
Featured
See All Featured
Designing for Performance
lara
610
70k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
640
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
180
Mind Mapping
helmedeiros
PRO
0
78
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
92
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Typedesign – Prime Four
hannesfritz
42
2.9k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
170
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
160
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
320
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
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