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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Kazuhiro NISHIYAMA
June 13, 2015
Programming
150
0
Share
正規表現の \z の話
あるちょっと遅そうな正規表現を高速化した話
Kazuhiro NISHIYAMA
June 13, 2015
More Decks by Kazuhiro NISHIYAMA
See All by Kazuhiro NISHIYAMA
Headscale + Tailscale に移行中
znz
0
46
Ruby on Rails と私
znz
0
64
riscv64.rubyci.org internal
znz
0
53
Rubyの日本語リファレンスマニュアルの現在と未来
znz
0
100
devise-two-factorを4.xから5.xに上げた話
znz
0
400
docs.ruby-lang.org/ja/ の生成方法を変えた
znz
0
110
Ubuntuのriscv64版をqemuで動かした
znz
0
130
lilo.linux.or.jpをbusterからbullseyeに上げた
znz
0
130
小規模個人アプリをRails 7.xにバージョンアップした話
znz
0
130
Other Decks in Programming
See All in Programming
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
1
220
t *testing.T は どこからやってくるの?
otakakot
1
840
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
24
16k
AIと共に生きる技術選定 2026
sgash708
0
110
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.2k
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
260
Back to the roots of date
jinroq
0
570
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
250
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
180
JOAI2026 1st solution - heron0519 -
heron0519
0
160
アーキテクチャモダナイゼーションとは何か
nwiizo
19
5.6k
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.1k
Featured
See All Featured
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
380
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
530
Crafting Experiences
bethany
1
130
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Designing for humans not robots
tammielis
254
26k
Building an army of robots
kneath
306
46k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
280
エンジニアに許された特別な時間の終わり
watany
106
240k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
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