Writing Perl 6 Rx

362
-1

Published on

Perl 6 is here today ... for some uses, like writing parsing scripts, that would be too complicated for a single Perl 5 regex. This is an overview what has changed.

Published in: Technology, Sports
2 Comments
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
362
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
2
Likes
0
Embeds 0
No embeds

No notes for slide

Writing Perl 6 Rx

  1. 1. Perl 6 regex
  2. 2. Perl 6 regexIn search for perfection
  3. 3. Many Things Gone
  4. 4. Some Stayed capturing: (…) escape: mods: i, g quantifier: *, +, ? alternatives: | match var.: $/min. match. suffix: ??, *?, +?
  5. 5. Operators
  6. 6. Create A Regex rx/.../
  7. 7. Its The New qr// rx/.../
  8. 8. Apply Rx ~~,
  9. 9. Known Since 5.10 ~~,
  10. 10. Still Changing In 5.18 ~~,
  11. 11. Apply Rx ~~,no more =~
  12. 12. Operatorsm// s///
  13. 13. Rx Methodsmatch comb subst
  14. 14. Operatorsms// ss///
  15. 15. Operatorsm :s// s :ss///
  16. 16. Modifiers no x
  17. 17. Modifiersno x m s
  18. 18. Modifiersno s e x
  19. 19. Modifiersno s ee x
  20. 20. ModifiersP5 Perl5
  21. 21. Modifiers:P5 :Perl5
  22. 22. Modifiers~~ m :P5 /.../
  23. 23. Modifiers:g :global
  24. 24. Match x Times :x(n)
  25. 25. Just nth Match :nth(n)
  26. 26. Search from Pos On :c(n) :continue(n)
  27. 27. Search Only On Pos :p(n) :pos(n)
  28. 28. Spaces Have Meaning :s :sigspace:ss :samespace
  29. 29. Like qw// Only Smarter :s :sigspace:ss :samespace
  30. 30. Lower Line Is For s/// :s :sigspace:ss :samespace
  31. 31. Modifiers:i :ignorecase:ii :samecase
  32. 32. Modifiers :m :ignoremark:mm :samemark
  33. 33. Choose A Level :bytes :chars:codes :graphs
  34. 34. Metachar
  35. 35. Metachar .
  36. 36. Metachar .any char
  37. 37. Metachar .
  38. 38. Metachar .
  39. 39. No Output In Perl 5perl -e print 1 if "n"=~ /./
  40. 40. Do Output In Perl 6perl6 -e say 1 if "n"~~ /./
  41. 41. Metachar .any char
  42. 42. Metachar Nnot a newline
  43. 43. Metachar ^ $You know that
  44. 44. Metachar^^ $$linewise
  45. 45. a Wins In Perl 5perl -E "ab"=~ /(a|ab)/;say $1
  46. 46. ab Wins In Perl 6perl6 -E "ab"~~/(a|ab)/;say $0
  47. 47. Metachar |longest wins
  48. 48. Metachar ||first wins
  49. 49. Metachar ()capt. groups
  50. 50. Metachar []nonecapturing groups
  51. 51. Metachar <[ ]>char classes
  52. 52. Metachar s space
  53. 53. Metachar s = h | vhorizont. or vertic.
  54. 54. Metachars = h | vr n and alike
  55. 55. Metachar s = h | vSpaces, tabs(t) and alike
  56. 56. Quantifiers
  57. 57. Quantifierssimple havenot changed
  58. 58. Five Digits d ** 5
  59. 59. Five Digits d ** 5 12345
  60. 60. Two to Five Digits d ** 2..5
  61. 61. Colon Seperated Digits d+ % ,
  62. 62. Colon Seperated Digits d+ % , 1,2,3,4
  63. 63. + Trailing Seperator d+ %% , 1,2,3,4,
  64. 64. Combinedd ** 2..* % ,
  65. 65. Special Var
  66. 66. Match Object $/last sucessful Match
  67. 67. Named Submatch $/ $/<...>
  68. 68. Named Submatch $/ $/{...} $<...>
  69. 69. List Of Matches @()
  70. 70. List Of Matches @() @() = $0 ..
  71. 71. List Of Matches @()[n]@() = $0 ..(no limit)
  72. 72. AoA Of Matches @()[1][2].(.).(.(.).(.).(...).).
  73. 73. Learn Morehttp://perlcabal.org /syn/S05.html
  74. 74. Thank You
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×