ScottsPerl6Notes
22 Nov 2009 01:31 UTC 2009326+0131 UTC

ScottDuff.ScottsPerl6Notes History

Hide minor edits - Show changes to markup

November 23, 2003, at 03:04 PM by unknown -
Added lines 1-2:
November 20, 2003, at 10:38 AM by unknown -
Changed line 1 from:
to:
November 20, 2003, at 10:38 AM by unknown -
Changed lines 1-50 from:

Notes on http://www.perl.com/lpt/a/2002/06/04/apo5.html Apocalypse 5

  • Brave new world
	(...) capturing brackets
	[...] grouping brackets (non capturing)
	{...} closure (return value ignored unless assigned)
	<...> Assertion (does this thing match?)
	:...  introduces a meta-syntactic token (a modifier)

$0 is the match object. Assigning to $0 affects the return value of the RE

Built-in regular expression modifiers

Long ModifierShort ModifierMeaning
:cont:cContinue from where the previous match left off
:words:wMatch a sequence of "words". Causes whitespace (which is normally ignored) to be replaced by \s+ between identifier and \s* anywhere else
:ignorecase:iMatch all alphabetic characters in a case insensitive manner
:any:areturns a list of anywhere the pattern matches within the string regardless of overlap
:each:eapply the pattern iteratively ("each" time we can)
:once:oMatch succeeds exactly once. To allow the RE to match again, execute the .reset() method on the RE object.
?:p5Perl 5 matching. Cause the RE to be interpreted using the Perl 5 rules
?:u0Level 0 Unicode support. A . (dot) matches bytes
?:u1Level 1 Unicode support. A . (dot) matches code points
?:u2Level 2 Unicode support. A . (dot) matches a grapheme
?:u3Level 3 Unicode support. What . (dot) matches is language dependent
?:1stonly match the first occurance of the pattern
?:2ndonly match the second occurance of the pattern
?:3rdonly match the third occurance of the pattern
?:4thonly match the fourth occurance of the pattern
?:5thonly match the fifth occurance of the pattern
.........
?:1xMatch one time
?:2xMatch two times
?:3xMatch three times
.........

Built-in assertions

assertionmeaning
<alpha>matches any alphabetic character
<digit>matches any numeric character
<sp>matches a space character
<prior>match whatever the most recently successful match did
<after pattern>matches only after pattern (zero-width)
<before pattern>matches only before pattern (zero-width)
<commit>fails the match if backtracked to
<cut>fails the match if backtracked to and removes the portion of the string that matched to that point
<fail>causes the match to fail if reached
<null>match nothing
to:
November 20, 2003, at 08:45 AM by unknown -
Changed lines 45-46 from:
<after pattern>match if the pattern occurs after pattern
<before pattern>match if the pattern occurs before pattern
to:
<after pattern>matches only after pattern (zero-width)
<before pattern>matches only before pattern (zero-width)
November 20, 2003, at 08:41 AM by unknown -
Changed line 1 from:
to:

Notes on http://www.perl.com/lpt/a/2002/06/04/apo5.html Apocalypse 5

Changed lines 3-50 from:

Describe Scotts Perl 6 Notes here.

to:
  • Brave new world
	(...) capturing brackets
	[...] grouping brackets (non capturing)
	{...} closure (return value ignored unless assigned)
	<...> Assertion (does this thing match?)
	:...  introduces a meta-syntactic token (a modifier)

$0 is the match object. Assigning to $0 affects the return value of the RE

Built-in regular expression modifiers

Long ModifierShort ModifierMeaning
:cont:cContinue from where the previous match left off
:words:wMatch a sequence of "words". Causes whitespace (which is normally ignored) to be replaced by \s+ between identifier and \s* anywhere else
:ignorecase:iMatch all alphabetic characters in a case insensitive manner
:any:areturns a list of anywhere the pattern matches within the string regardless of overlap
:each:eapply the pattern iteratively ("each" time we can)
:once:oMatch succeeds exactly once. To allow the RE to match again, execute the .reset() method on the RE object.
?:p5Perl 5 matching. Cause the RE to be interpreted using the Perl 5 rules
?:u0Level 0 Unicode support. A . (dot) matches bytes
?:u1Level 1 Unicode support. A . (dot) matches code points
?:u2Level 2 Unicode support. A . (dot) matches a grapheme
?:u3Level 3 Unicode support. What . (dot) matches is language dependent
?:1stonly match the first occurance of the pattern
?:2ndonly match the second occurance of the pattern
?:3rdonly match the third occurance of the pattern
?:4thonly match the fourth occurance of the pattern
?:5thonly match the fifth occurance of the pattern
.........
?:1xMatch one time
?:2xMatch two times
?:3xMatch three times
.........

Built-in assertions

assertionmeaning
<alpha>matches any alphabetic character
<digit>matches any numeric character
<sp>matches a space character
<prior>match whatever the most recently successful match did
<after pattern>match if the pattern occurs after pattern
<before pattern>match if the pattern occurs before pattern
<commit>fails the match if backtracked to
<cut>fails the match if backtracked to and removes the portion of the string that matched to that point
<fail>causes the match to fail if reached
<null>match nothing
Page last modified on September 29, 2005, at 09:28 PM