Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
100
Lessons learned from building serverless, distributed architecture
dawny33
1
140
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
AIコーディングエージェント(Manus)
kondai24
0
160
dnx で実行できるコマンド、作ってみました
tomohisa
0
140
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
5
2k
STYLE
koic
0
160
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
160
エディターってAIで操作できるんだぜ
kis9a
0
710
ゲームの物理 剛体編
fadis
0
330
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
18
7.3k
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
130
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
310
開発に寄りそう自動テストの実現
goyoki
1
780
Cell-Based Architecture
larchanjo
0
110
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
225
10k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
The Cult of Friendly URLs
andyhume
79
6.7k
Code Reviewing Like a Champion
maltzj
527
40k
BBQ
matthewcrist
89
9.9k
What's in a price? How to price your products and services
michaelherold
246
12k
GitHub's CSS Performance
jonrohan
1032
470k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
KATA
mclloyd
PRO
32
15k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
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