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
正規表現の少し進んだ機能 / regex lookahead
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
USAMI Kosuke
August 19, 2022
Programming
570
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
正規表現の少し進んだ機能 / regex lookahead
※ Docswell に移行しました
https://www.docswell.com/s/usami-k/58GRDQ-regex-lookahead
USAMI Kosuke
August 19, 2022
More Decks by USAMI Kosuke
See All by USAMI Kosuke
Onsager代数とその周辺 / Onsager algebra tsudoi
usamik26
0
700
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
260
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
390
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
550
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
820
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
730
UICollectionView Compositional Layout
usamik26
0
870
Coding Swift with Visual Studio Code and Docker
usamik26
0
580
Swift Extension for Visual Studio Code
usamik26
2
1.1k
Other Decks in Programming
See All in Programming
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.3k
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
250
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.1k
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
120
Old Dog, New Tricks: The Java 25 Reinvention - JNation
bazlur_rahman
0
150
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
210
Observability in Practice:Grafana 與 Edge Device SRE 的那些事
blueswen
0
120
今さら聞けないCancellationToken
htkym
0
220
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
1.5k
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
310
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
630
Featured
See All Featured
New Earth Scene 8
popppiees
3
2.3k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Everyday Curiosity
cassininazir
0
220
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
We Are The Robots
honzajavorek
0
240
The Spectacular Lies of Maps
axbom
PRO
1
790
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
220
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
830
Transcript
正規表現の 少し進んだ機能 宇佐見公輔 / 株式会社ゆめみ
自己紹介 宇佐見公輔 / 株式会社ゆめみ / iOS テックリード 大阪在住、最寄のゆめみオフィスは京都(まだ物理出社してないが) 来月のiOSDC にパンフレット記事寄稿、トーク登壇予定
来月の技術書典に出展予定
正規表現を再勉強中 Swift で正規表現が言語組み込みになる この機会に、正規表現を再勉強 意外と知らない機能がいろいろあった 例:名前付きキャプチャ、後方参照 書いた:Swift Regex でキャプチャや名前付きキャプチャを使う -
Qiita
正規表現の基本 文字列のパターンマッチ 部分文字列の抽出(キャプチャ)
位置へのマッチ アンカー:「文字列」でなく「位置」にマッチする 長さ0 の文字列にマッチすると考えて、ゼロ幅アサーションとも呼ばれる ^ (先頭) $ (末尾) \b (単語の境界)など
` ` ` ` ` `
少し進んだ機能の紹介 先読み(lookahead ) 後読み(lookbehind )
先読み 先読み(lookahead )は、位置にマッチする記法の一種で、位置の指定に正 規表現が使える。 (?= と ) で囲む。 ` `
` ` a(?=..d) → 「a 」の次に「任意の2 文字+d 」が来る場合に限り、「a 」にマッチする
後読み (?=regex) : 先読み。次に regex がくる位置にマッチ。 (?<=regex) : 後読み。前に regex
がくる位置にマッチ。 ` ` ` ` ` ` ` `
否定先読み・否定後読み (?!regex) : 否定先読み。次に regex がこない位置にマッチ。 (?<!regex) : 否定後読み。前に regex
がこない位置にマッチ。 ` ` ` ` ` ` ` `
先読みが便利な場合 (1) 複数の正規表現すべてにマッチするか
先読みが便利な場合 (2) 数値の3 桁ごとにカンマを挿入するコード → これ、どうなってるの?
先読みが便利な場合 (2) 解説
書籍
便利ツール