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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
Cosmos World Foundation Model Platform for Physical AI
takmin
0
760
Webhook best practices for rock solid and resilient deployments
glaforge
1
280
変化するコーディングエージェントとの現実的な付き合い方 〜Cursor安定択説と、ツールに依存しない「資産」〜
empitsu
4
1.3k
小さく始めるBCP ― 多プロダクト環境で始める最初の一歩
kekke_n
1
380
Azure Durable Functions で作った NL2SQL Agent の精度向上に取り組んだ話/jat08
thara0402
0
160
FinTech SREのAWSサービス活用/Leveraging AWS Services in FinTech SRE
maaaato
0
130
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
140
仕様書駆動AI開発の実践: Issue→Skill→PRテンプレで 再現性を作る
knishioka
2
620
CDKで始めるTypeScript開発のススメ
tsukuboshi
1
370
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
13k
AI駆動PjMの理想像 と現在地 -実践例を添えて-
masahiro_okamura
1
110
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
68k
Featured
See All Featured
Scaling GitHub
holman
464
140k
Code Review Best Practice
trishagee
74
20k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
79
GitHub's CSS Performance
jonrohan
1032
470k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
54
The SEO Collaboration Effect
kristinabergwall1
0
350
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
280
Typedesign – Prime Four
hannesfritz
42
2.9k
The agentic SEO stack - context over prompts
schlessera
0
630
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
51
AI: The stuff that nobody shows you
jnunemaker
PRO
2
250
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