Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Perl 6 Regex
Search
lichtkind
September 05, 2015
Programming
0
170
Perl 6 Regex
features and syntax of the new reformed Perl Regular Expression
lichtkind
September 05, 2015
Tweet
Share
More Decks by lichtkind
See All by lichtkind
Perl 6 in context
lichtkind
0
67
Perl 6 OOP
lichtkind
0
220
Perl 6 data structures
lichtkind
0
130
functional Perl 6
lichtkind
0
790
Other Decks in Programming
See All in Programming
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
4
560
Atomics APIを知る / Understanding Atomics API
ssssota
1
230
30分でDoctrineの仕組みと使い方を完全にマスターする / phpconkagawa 2025 Doctrine
ttskch
3
640
なぜ強調表示できず ** が表示されるのか — Perlで始まったMarkdownの歴史と日本語文書における課題
kwahiro
12
7.4k
Querying Design System デザインシステムの意思決定を支える構造検索
ikumatadokoro
1
1.2k
データファイルをAWSのDWHサービスに格納する / 20251115jawsug-tochigi
kasacchiful
2
100
[SF Ruby Conf 2025] Rails X
palkan
0
390
競馬で学ぶ機械学習の基本と実践 / Machine Learning with Horse Racing
shoheimitani
14
14k
Duke on CRaC with Jakarta EE
ivargrimstad
0
340
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
190
アーキテクチャと考える迷子にならない開発者テスト
irof
9
3.4k
乱雑なコードの整理から学ぶ設計の初歩
masuda220
PRO
32
15k
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Being A Developer After 40
akosma
91
590k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Writing Fast Ruby
sferik
630
62k
The Invisible Side of Design
smashingmag
302
51k
Why Our Code Smells
bkeepers
PRO
340
57k
Embracing the Ebb and Flow
colly
88
4.9k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
2.9k
The Cost Of JavaScript in 2023
addyosmani
55
9.3k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Transcript
Perl 6 regex
Perl 6 regex In search for perfection
Much is Gone
Something Stayed ops: m//, s/// , tr/// mods: i, g
capturing: (…) escape: \ quantifier: *, +, ? min. match. suffix: ??, *?, +? alternatives: | match var.: $1 .. $9
Operators
Create A Regex rx/.../
It's The New qr// rx/.../
Apply Rx ~~
Known Since 5.10 ~~
Still Changing In 5.18 ~~
Apply Rx ~~ no more =~
Known Operators m// s///
Rx Methods match comb subst
New Operators ms// ss///
Aliases For: m :s// s :ss///
Modifiers
Modifiers no x
Modifiers no x m s
Modifiers no s e x
Modifiers no s ee x
Modifiers P5 Perl5
Modifiers :P5 :Perl5
Modifiers ~~ m :P5 /.../
Match All :g :global
Match n Times :x(n)
Just nth Match :nth(n)
Search from Pos On :c(n) :continue(n)
Search Only On Pos :p(n) :pos(n)
Spaces Have Meaning :s :sigspace :ss :samespace
Like qw// Only Smarter :s :sigspace :ss :samespace
Lower Line Is For s/// :s :sigspace :ss :samespace
Modifiers :i :ignorecase :ii :samecase
Modifiers :m :ignoremark :mm :samemark
Choose A Level :bytes :chars :codes :graphs
Metachar
Metachar .
Metachar . any char
Metachar .
Metachar .
No Output In Perl 5 perl -e 'print 1 if
"\n"=~ /./
Do Output In Perl 6 perl6 -e 'say 1 if
"\n"~~ /./
Metachar . any char
Metachar \N not a newline
Metachar ^ $ You know that
Metachar ^^ $$ linewise
'a' Wins In Perl 5 perl -E '"ab"=~ /(a|ab)/;say $1'
'ab' Wins In Perl 6 perl6 -E '"ab"~~/(a|ab)/;say $0'
Metachar | longest wins
Metachar || first wins
Metachar () capt. groups
Metachar [ ] nonecapturing groups
Metachar <[ ]> char classes
Metachar \s space
Metachar \s = \h | \v horizont. or vertic.
Metachar \s = \h | \v \r \n and alike
Metachar \s = \h | \v Spaces, tabs(\t) and alike
Quantifiers
Quantifiers simple have not changed
Five Digits \d ** 5
Five Digits \d ** 5 '12345'
Two to Five Digits \d ** 2..5
Colon Seperated Digits \d+ % ','
Colon Seperated Digits \d+ % ',' '1,2,3,4'
+ Trailing Seperator \d+ %% ',' '1,2,3,4,'
Combined \d ** 2..* % ','
Special Var
Match Object $/ last sucessful Match
Named Submatch $/ $/<...>
Named Submatch $/ $/{'...'} $<...>
List Of Matches @()
List Of Matches @() @() = $0 ..
List Of Matches @()[n] @() = $0 .. (no limit)
AoA Of Matches @()[1][2] .(.).(.(.).(.).(...).).
Learn More http://perlcabal.org /syn/S05.html
Thank You