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
正規表現の \z の話
Search
Kazuhiro NISHIYAMA
June 13, 2015
Programming
0
140
正規表現の \z の話
あるちょっと遅そうな正規表現を高速化した話
Kazuhiro NISHIYAMA
June 13, 2015
Tweet
Share
More Decks by Kazuhiro NISHIYAMA
See All by Kazuhiro NISHIYAMA
Ruby on Rails と私
znz
0
23
riscv64.rubyci.org internal
znz
0
18
Rubyの日本語リファレンスマニュアルの現在と未来
znz
0
67
devise-two-factorを4.xから5.xに上げた話
znz
0
330
docs.ruby-lang.org/ja/ の生成方法を変えた
znz
0
81
Ubuntuのriscv64版をqemuで動かした
znz
0
100
lilo.linux.or.jpをbusterからbullseyeに上げた
znz
0
110
小規模個人アプリをRails 7.xにバージョンアップした話
znz
0
94
Ruby リファレンスマニュアル改善計画 2022 進捗報告
znz
0
150
Other Decks in Programming
See All in Programming
CSC509 Lecture 01
javiergs
PRO
1
430
高度なUI/UXこそHotwireで作ろう Kaigi on Rails 2025
naofumi
4
3.2k
プログラミングどうやる? ~テスト駆動開発から学ぶ達人の型~
a_okui
0
190
Playwrightはどのようにクロスブラウザをサポートしているのか
yotahada3
7
2.2k
CSC305 Lecture 04
javiergs
PRO
0
230
メモリ不足との戦い〜大量データを扱うアプリでの実践例〜
kwzr
1
770
クラシルを支える技術と組織
rakutek
0
190
Model Pollution
hschwentner
1
180
CSS Linter の現在地 2025年のベストプラクティスを探る
ryo_manba
10
3.2k
育てるアーキテクチャ:戦い抜くPythonマイクロサービスの設計と進化戦略
fujidomoe
1
150
Reduxモダナイズ 〜コードのモダン化を通して、将来のライブラリ移行に備える〜
pvcresin
2
670
Go Conference 2025: Goで体感するMultipath TCP ― Go 1.24 時代の MPTCP Listener を理解する
takehaya
7
1.5k
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.1k
GraphQLとの向き合い方2022年版
quramy
49
14k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
9
570
Why Our Code Smells
bkeepers
PRO
339
57k
Balancing Empowerment & Direction
lara
4
670
Visualization
eitanlees
148
16k
How GitHub (no longer) Works
holman
315
140k
4 Signs Your Business is Dying
shpigford
185
22k
Bash Introduction
62gerente
615
210k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
2.6k
Embracing the Ebb and Flow
colly
88
4.8k
Transcript
正規表現の� � \z� の話 あるちょっと遅そうな正規表現を� � ⾼速化した話 Kazuhiro� NISHIYAMA 第67回�
Ruby関⻄� 勉強会 2015/06/13
自⼰紹介 twitter� や� github� では� @znz
Ruby� 関連 Ruby� (CRuby)� のコミッター Ruby� 関係でいろいろ るびま� (Rubyist� Magazine)�
とか http://magazine.rubyist.net/ るりま� (Ruby� リファレンスマニュア ル)� とか http://docs.ruby-lang.org/ja/ Ruby� 関連のイベントでの発表
とある正規表現 �������� 遅そう ⽂字列末尾以外にもマッチする
⽂字クラスを使う ������� 速くなった(ベンチマークは後で)
\z� を使う �������� �:� ⾏末にマッチ ��:� ⽂字列末尾のみにマッチ もっと速くなった
ベンチマーク ������������������� ��������������� ������������������� ��������������������� �������� ��������������������� ������������������������������������������������������ ������������������������������������������������������ ������������������������������������������������������
������������������������������������������������������ ���
ベンチマーク結果� (1) ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������ �������������������������������������������������������
������������������������������������������������������� ������������������������������������������������������� �������������������������������������������������������
ベンチマーク結果� (2) ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������� ������������������������������������������������������ �������������������������������������������������������
������������������������������������������������������� ������������������������������������������������������� �������������������������������������������������������
まとめ 1⽂字の場合は選択� (ん|ン)� では なく⽂字クラス� [んン]� を使おう ⽂字列末尾は� $� ではなく�
\z