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
The 1960s elegance behind Go's regexp
Search
Jalem Raj Rohit
March 19, 2017
Programming
1
190
The 1960s elegance behind Go's regexp
The presentation is given at FOSS Asia Summit 2017
Jalem Raj Rohit
March 19, 2017
Tweet
Share
More Decks by Jalem Raj Rohit
See All by Jalem Raj Rohit
Training and leveraging graph embeddings at scale
dawny33
2
96
Lessons learned from building serverless, distributed architecture
dawny33
1
130
Regression Analysis: The good, the bad and untold
dawny33
2
420
Understanding Serverless Architectures
dawny33
2
1.6k
Other Decks in Programming
See All in Programming
オープンセミナー2025@広島「君はどこで動かすか?」アンケート結果
satoshi256kbyte
0
200
オホーツクでコミュニティを立ち上げた理由―地方出身プログラマの挑戦 / TechRAMEN 2025 Conference
lemonade_37
2
490
ライブ配信サービスの インフラのジレンマ -マルチクラウドに至ったワケ-
mirrativ
2
260
あなたとJIT, 今すぐアセンブ ル
sisshiki1969
1
720
[FEConf 2025] 모노레포 절망편, 14개 레포로 부활하기까지 걸린 1년
mmmaxkim
0
980
AHC051解法紹介
eijirou
0
620
Nuances on Kubernetes - RubyConf Taiwan 2025
envek
0
190
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
170
デザインシステムが必須の時代に
yosuke_furukawa
PRO
2
100
AIエージェント開発、DevOps and LLMOps
ymd65536
1
340
コンテキストエンジニアリング Cursor編
kinopeee
1
700
🔨 小さなビルドシステムを作る
momeemt
1
450
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Being A Developer After 40
akosma
90
590k
Statistics for Hackers
jakevdp
799
220k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
GitHub's CSS Performance
jonrohan
1031
460k
Six Lessons from altMBA
skipperchong
28
4k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
183
54k
How GitHub (no longer) Works
holman
315
140k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Building Adaptive Systems
keathley
43
2.7k
Transcript
The 1960s elegance behind Go’s regexp 19 MarchFOSS Asia ‘17
Jalem Raj Rohit
What this talk is about? About the two approaches to
regex matching. - One used in almost all standard regex interpreters, like Python, Perl, etc - The other one used in some implementations like, awk, grep, sed, etc And Go, of course
What exactly are Regular Expressions? - It’s a style of
describing character strings - If a string successfully describes a regex, then it is called a match
Examples: Let’s say e1 matches “s” and e2 matches “t”:
➔ Alternation If e1 | e2 ⇒ s or it ➔ Concatenation e1 e2 ⇒ st. ➔ e1* 0 or more s ➔ e1+ 1 or more s
Perl vs Golang time comparison for matching a?a?a?aaa with respect
to the string length
Aaaand welcome to: The world of super awesome Computer Science
! and Super awesome algorithms !
Meet Finite Automata - It’s also known as State Machines
- ← This one is a Deterministic Finite Automata (or a DFA)
Also, meet NFA - NFA stands for Nondeterministic Finite Automata
- Example on the left - It has multiple legit choices in state S2 Which one to choose? :( - Also, the machine can’t peek ahead
Converting Regexes to NFAs - This would be the basic
unit of the NFA - Concatenation be like: - Aaaand alternation
Perl’s algorithm at work - Also, called the backtracking approach
- Time complexity grows exponentially for pathological regex matches, as the string size grows. - Literally, out of the window
Can we make this better?
Thompson’s algorithm at work - Guesses both options simultaneously -
Allows the machine to be in multiple states at the same time - Linear time complexity. Yayyy !!!
Again, comparison of the algorithms
Again ….
Special Shoutout to GopherData - An attempt to bring together
Go’s and gophers’ efforts in Data Science and Analytics - Github: https://github.com/gopherdata - Twitter: https://twitter.com/GopherDataIO
THANK YOU - Github: Dawny33 - Twitter: @data__wizard (<-- 2
_’s there) - Facebook: rajrohit.33