Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
Transcript
79 slides
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
More Decks by N@N
See All by N@N
introduction to modern numerical analysis
spark6251
0
200
Finite Automaton equivalents to Regular Expression
spark6251
0
150
Programmer and English
spark6251
0
130
Let's go to the study session
spark6251
0
120
Quantum Computation
spark6251
0
280
Introduction to use Grunt
spark6251
0
110
Introduction to SCSS+COMPASS
spark6251
0
320
Introduction to Psychology
spark6251
1
310
Introduction to HTML5
spark6251
0
330
Other Decks in Technology
See All in Technology
ラクスル会社紹介資料|エンジニア向け / RAKSUL Introduction for Engineers
raksulrecruiting
0
120
OpenTelemetryで変わった 新時代のCloudWatchメトリクス監視
tsukuboshi
0
310
速くなるほど、深く考える AI時代のQAに学ぶ
kobayashiyorimitsu
0
240
サーバーラックは作る時代! 3Dプリンターで作る10インチラックのススメ
jacopen
1
290
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
1
370
狙われているAPIの脆弱性!今こそ手をつけるべき根本的な対策とは?
nagix
0
140
Context != Context: One window, many lifecycles (AI Native DevCon, Nov 2026)
birgitta410
0
150
BALLAS Technology Deck
ballas_inc
0
680
Linuxネットワークスタック進化の軌跡: 過去10年の歩みと最新トレンド
orimanabu
4
720
IP重複は"ランディングVPC"で受け止める ― PrivateLink と Transit Gatewayによるマルチテナント接続基盤の設計
hatahata021
2
190
田んぼの見回りをIoTで減らしたい!水位監視から電池駆動カメラまでの試行錯誤
itosoft
1
240
Intro to Kiro (One agent, every surface) | Kiro: Zero to Hero 01
inariku
PRO
2
140
Featured
See All Featured
Music & Morning Musume
bryan
48
7.5k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
840
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
530
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
121
130k
Mobile First: as difficult as doing things right
swwweet
225
10k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
520
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Skip the Path - Find Your Career Trail
mkilby
1
290
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
380
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Ethics towards AI in product and experience design
skipperchong
2
460