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
360
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
150
Programmer and English
spark6251
0
130
Let's go to the study session
spark6251
0
110
Quantum Computation
spark6251
0
280
Introduction to use Grunt
spark6251
0
110
Introduction to SCSS+COMPASS
spark6251
0
310
Introduction to Psychology
spark6251
1
300
Introduction to HTML5
spark6251
0
320
Other Decks in Technology
See All in Technology
脱SaaS!FDEを支えるプロビジョニングと分離設計
knih
0
250
フィジカル版Github Onshapeの紹介
shiba_8ro
0
310
事業会社における 機械学習・推薦システム技術の活用事例と必要な能力 / ml-recsys-in-layerx-wantedly-2026
yuya4
0
100
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
3k
OTel × Datadog で 「AI活用」を計測し、改善に繋げる
shihochan
2
530
AI-DLCを “そのまま導入しなかった”話 ~組織に合わせてアジャストした 私たちの実践共有~
hiroramos4
PRO
1
310
データサイエンスを価値につなげるプロジェクト設計 〜 DS一年目が現場で得た気づき 〜
ysd113
1
290
Bucharest Tech Week 2026 - Guardians of the Cloud-Native Galaxy
edeandrea
PRO
0
130
【2026年版】 ベクトル検索とEmbedding最前線
mocobeta
23
6.6k
“詰む”前に仕組みを作れ 〜技術の波に溺れないためのキャッチアップ術〜
takasyou
5
2.4k
[AWS Summit Japan 2026]迷っているあなたへ_小さな一歩が、やがて自分を助けてくれる
sh_fk2
1
310
「勝手に広まる」人気 AI エージェントを爆速で作ろう!(AWS Summit Japan 2026講演資料)
minorun365
PRO
10
2.2k
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
Mind Mapping
helmedeiros
PRO
1
260
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
610
Claude Code のすすめ
schroneko
67
230k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.6k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
460
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
240
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Color Theory Basics | Prateek | Gurzu
gurzu
0
370
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
170
Building a Scalable Design System with Sketch
lauravandoore
463
34k
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