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
Perl 6 Regex
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
lichtkind
September 05, 2015
Programming
180
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Perl 6 Regex
features and syntax of the new reformed Perl Regular Expression
lichtkind
September 05, 2015
More Decks by lichtkind
See All by lichtkind
Perl 6 in context
lichtkind
0
74
Perl 6 OOP
lichtkind
0
230
Perl 6 data structures
lichtkind
0
160
functional Perl 6
lichtkind
0
840
Other Decks in Programming
See All in Programming
Built Our Own Background Agent at LayerX #aidevex_findy
layerx
PRO
8
3.1k
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
340
Prismを使った型安全な暗号化_関数型まつり2026
_fhhmm
0
150
初めてのKubernetes 本番運用でハマった話
oku053
0
130
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
8
5.3k
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
330
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
220
自作OSでスライド発表する
uyuki234
1
3.9k
Claude Opus 4.6以後の受託開発エンジニアの変化(Claude Code開発ノウハウ大公開スペシャルbyクラスメソッド)
iidatakuma
1
840
関数型プログラミングのメリットって何だろう?
wanko_it
0
190
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
2.9k
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
9.3k
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
The Pragmatic Product Professional
lauravandoore
37
7.4k
The SEO Collaboration Effect
kristinabergwall1
1
510
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
810
The Cost Of JavaScript in 2023
addyosmani
55
10k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Building the Perfect Custom Keyboard
takai
2
820
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
350
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
Balancing Empowerment & Direction
lara
6
1.2k
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