Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
正規表現の \z の話
Kazuhiro NISHIYAMA
June 13, 2015
Programming
0
61
正規表現の \z の話
あるちょっと遅そうな正規表現を高速化した話
Kazuhiro NISHIYAMA
June 13, 2015
Tweet
Share
More Decks by Kazuhiro NISHIYAMA
See All by Kazuhiro NISHIYAMA
qemuのriscv64にDebianを入れてみた
znz
0
27
systemd 再入門
znz
0
120
Ruby 3.0.0 コネタ集
znz
0
100
livedoor天気API終了対応
znz
0
120
Wireguard 実践入門
znz
0
140
あまり知られていないRubyの便利機能
znz
0
140
workflow,job,step の使い分けの基準を考える
znz
0
110
Dockerのオフィシャルrubyイメージとは?
znz
0
36
チャットボットのススメ
znz
0
130
Other Decks in Programming
See All in Programming
Meet Swift Regex
usamik26
0
370
パターンマッチングを学んで新しいJavaの世界へ!Java 18までの目玉機能をおさらいしよう / Java 18 pattern matching
ihcomega56
3
450
Managing Error Messages with your Oracle Database REST APIs
thatjeffsmith
0
160
IE Graduation Certificate
jxck
6
4.9k
Angular‘s Future without NgModules: Architectures with Standalone Components @enterJS
manfredsteyer
PRO
0
250
Jetpack Compose, 어디까지 알고 있을까?
jisungbin
0
130
Angular-basierte Micro Frontends mit Module Federation @API Summit
manfredsteyer
PRO
0
120
The strategies behind ddd – AdeoDevSummit 2022
lilobase
PRO
5
270
VisualProgramming_GoogleHome_LINE
nearmugi
1
240
Rector, time to refactor your code easily
guikingone
1
110
ES2022の新機能
smt7174
0
280
How we run a Realtime Puzzle Fighting Game on AWS Serverless
falken
0
260
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
28
6.6k
Documentation Writing (for coders)
carmenhchung
48
2.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
39
13k
For a Future-Friendly Web
brad_frost
166
7.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
119
28k
How to name files
jennybc
40
61k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
224
49k
Raft: Consensus for Rubyists
vanstee
126
5.5k
In The Pink: A Labor of Love
frogandcode
131
21k
VelocityConf: Rendering Performance Case Studies
addyosmani
316
22k
The Invisible Customer
myddelton
110
11k
Robots, Beer and Maslow
schacon
152
7.1k
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