Perl 6 regex
Perl 6 regex


In search for perfection
Many Things Gone
Some Stayed
 capturing: (…) escape: 
         mods: i, g
     quantifier: *, +, ?
       alternatives: |
      match var.: $/
min. match. suffix: ??, *?, +?
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 =~
Operators


m// s///
Rx Methods

match comb
  subst
Operators


ms// ss///
Operators


m :s// s :ss///
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 /.../
Modifiers


:g :global
Match x 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

More Related Content

ODP
Parameter passing
PPT
best first-sort
PDF
Virtual Machine for Regular Expressions
PPT
PPTX
Understand more about C
ODP
Recursion and Functional Programming
PPTX
Pressure drop model presentation april 19th
PPTX
Functional Programming Concepts for Imperative Programmers
Parameter passing
best first-sort
Virtual Machine for Regular Expressions
Understand more about C
Recursion and Functional Programming
Pressure drop model presentation april 19th
Functional Programming Concepts for Imperative Programmers

What's hot (14)

PDF
Linked list Output tracing
DOC
Sequential Circuits I VLSI 9th experiment
PPTX
Presentation1
PDF
Lisp tutorial
PPT
String matching with finite state automata
PPT
Csc1100 lecture05 ch05
PPT
Csc1100 lecture06 ch06_pt2
PPTX
Introduction to SkyPat 2.0
KEY
TDD Boot Camp 東京 for C++ 進行
PPTX
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
PDF
Applications of stack
PDF
Algorithm and Programming (Looping Structure)
PPT
Csc1100 lecture06 ch06_pt1
PDF
Garbage Collection
Linked list Output tracing
Sequential Circuits I VLSI 9th experiment
Presentation1
Lisp tutorial
String matching with finite state automata
Csc1100 lecture05 ch05
Csc1100 lecture06 ch06_pt2
Introduction to SkyPat 2.0
TDD Boot Camp 東京 for C++ 進行
STACK || FUNCTION WRITING BASED ON STACK || DATA STRUCTURE || LINKED LIST || ...
Applications of stack
Algorithm and Programming (Looping Structure)
Csc1100 lecture06 ch06_pt1
Garbage Collection
Ad

Viewers also liked (9)

PDF
P6oo
PDF
Modern wx perl
PDF
Perl 5 Quiz Chemnitz Edition
PDF
Complete Programming
KEY
(Parameterized) Roles
PDF
Perl 5.20: Feature, Kultur, Module, Werkzeuge
PDF
P6 OO vs Moose (&Moo)
PDF
Learning Perl 6
P6oo
Modern wx perl
Perl 5 Quiz Chemnitz Edition
Complete Programming
(Parameterized) Roles
Perl 5.20: Feature, Kultur, Module, Werkzeuge
P6 OO vs Moose (&Moo)
Learning Perl 6
Ad

Similar to Writing Perl 6 Rx (20)

PDF
Working with text, Regular expressions
PPT
Bioinformatica 06-10-2011-p2 introduction
PPTX
Unit 1-strings,patterns and regular expressions
PPTX
Strings,patterns and regular expressions in perl
PDF
What's new in Perl 5.14
PDF
Perl_Part4
ODP
Advanced Perl Techniques
PDF
Lecture 23
PDF
Old Dogs & New Tricks: What's New With Perl5 This Century
PDF
Tutorial on Regular Expression in Perl (perldoc Perlretut)
PDF
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
ODP
Introduction to Modern Perl
ODP
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
PPT
Perl Presentation
PDF
Perl Programming - 02 Regular Expression
PPTX
Bioinformatics p2-p3-perl-regexes v2014
PPTX
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
PPTX
Patterns
PPT
PERL Regular Expression
PPT
regex.ppt
Working with text, Regular expressions
Bioinformatica 06-10-2011-p2 introduction
Unit 1-strings,patterns and regular expressions
Strings,patterns and regular expressions in perl
What's new in Perl 5.14
Perl_Part4
Advanced Perl Techniques
Lecture 23
Old Dogs & New Tricks: What's New With Perl5 This Century
Tutorial on Regular Expression in Perl (perldoc Perlretut)
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
Introduction to Modern Perl
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
Perl Presentation
Perl Programming - 02 Regular Expression
Bioinformatics p2-p3-perl-regexes v2014
Bioinformatics p2-p3-perl-regexes v2013-wim_vancriekinge
Patterns
PERL Regular Expression
regex.ppt

More from lichtkind (16)

PDF
Perl 6 in Context
PDF
Wx::Perl::Smart
PDF
P6kontext2014
PDF
Wundertüte Perl
PDF
Perl 6 Regex und Grammars
ODP
Perl 6 Datastructures
ODP
Perl 6 Datenstrukturen
PDF
Document Driven Development
PDF
Bettereditors
PDF
Hgit
PDF
Was können wir von Rebol lernen?
PDF
Neuperl6
PDF
Perl Testing
PDF
Perl in der Wiki
PDF
What is Kephra about?
PDF
What we can learn from Rebol?
Perl 6 in Context
Wx::Perl::Smart
P6kontext2014
Wundertüte Perl
Perl 6 Regex und Grammars
Perl 6 Datastructures
Perl 6 Datenstrukturen
Document Driven Development
Bettereditors
Hgit
Was können wir von Rebol lernen?
Neuperl6
Perl Testing
Perl in der Wiki
What is Kephra about?
What we can learn from Rebol?

Recently uploaded (20)

PDF
A review of recent deep learning applications in wood surface defect identifi...
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
Modernising the Digital Integration Hub
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Five Habits of High-Impact Board Members
PDF
STKI Israel Market Study 2025 version august
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
The various Industrial Revolutions .pptx
PPTX
Benefits of Physical activity for teenagers.pptx
DOCX
search engine optimization ppt fir known well about this
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Getting started with AI Agents and Multi-Agent Systems
A review of recent deep learning applications in wood surface defect identifi...
observCloud-Native Containerability and monitoring.pptx
Univ-Connecticut-ChatGPT-Presentaion.pdf
Modernising the Digital Integration Hub
sustainability-14-14877-v2.pddhzftheheeeee
CloudStack 4.21: First Look Webinar slides
Assigned Numbers - 2025 - Bluetooth® Document
NewMind AI Weekly Chronicles – August ’25 Week III
Five Habits of High-Impact Board Members
STKI Israel Market Study 2025 version august
Hindi spoken digit analysis for native and non-native speakers
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
1 - Historical Antecedents, Social Consideration.pdf
The various Industrial Revolutions .pptx
Benefits of Physical activity for teenagers.pptx
search engine optimization ppt fir known well about this
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Getting started with AI Agents and Multi-Agent Systems

Writing Perl 6 Rx