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
150
0
Share
正規表現の \z の話
あるちょっと遅そうな正規表現を高速化した話
Kazuhiro NISHIYAMA
June 13, 2015
More Decks by Kazuhiro NISHIYAMA
See All by Kazuhiro NISHIYAMA
Headscale + Tailscale に移行中
znz
0
41
Ruby on Rails と私
znz
0
60
riscv64.rubyci.org internal
znz
0
51
Rubyの日本語リファレンスマニュアルの現在と未来
znz
0
98
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
Kubernetes上でAgentを動かすための最新動向と押さえるべき概念まとめ
sotamaki0421
3
460
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
400
アーキテクチャモダナイゼーションとは何か
nwiizo
17
4.8k
Symfonyの特性(設計思想)を手軽に活かす特性(trait)
ickx
0
130
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
640
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
890
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
240
CDK Deployのための ”反響定位”
watany
4
640
「速くなった気がする」をデータで疑う
senleaf24
0
150
Rethinking API Platform Filters
vinceamstoutz
0
11k
SkillがSkillを生む:QA観点出しを自動化した
sontixyou
6
3.2k
How Swift's Type System Guides AI Agents
koher
0
200
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
510
Art, The Web, and Tiny UX
lynnandtonic
304
21k
ラッコキーワード サービス紹介資料
rakko
1
3M
Writing Fast Ruby
sferik
630
63k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
140
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
330
Mobile First: as difficult as doing things right
swwweet
225
10k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Faster Mobile Websites
deanohume
310
31k
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