Intro    Chapter:   0. History   1. Design   2. Basic   3. Var   4. Op   5. IO   6. Block   7. Sub   8. OOP   9. Regex   10. Meta
Overview   Appendix:   A. Index   B. Grouped   C. Classtree   D. Delta   E. Exciting   F. FAQ   G. Glossary   H. Href 

"We put the 'Regular' back into 'Expression'." — Larry Wall

Similar to quotes, Regular Expressions are now a sublanguage, a language inside the language (slang ), instead of just being funny strings. They are parsed by a completely different set of rules, which are stored in the special variable $~Regex ($~Trans for transliterations and $~P5Regex for compatible Regexes). However, these rules are much more consistant with the main language than before.

Literal Character

Every alphanumeric character has no special meaning and matches the character itself. If a backslash (\) is placed directly in front of the character it becomes a metacharacter. For non-alphanumeric chars the opposite is true. That is, a backslashed character always has a special meaning or is invalid. Inside of quotes every char is literal.

Metacharacter

table

Modifier

xxx

Operators

rx/.../ aka Q :regex /.../
m/.../ aka Q :match /.../
ms/.../ aka Q :match :sigspace /.../.../
s/.../.../ aka Q :subst /.../.../
ss/.../.../ aka Q :subst :samespace /.../.../
tr/.../.../ aka Q :trans /.../.../

Methods

comb
match
subst
trans

Special Variables

$/
$<..>
$()
$0 ..

Matching

m//

Substitution

s///

Transliteration

my $escaped = $html.trans(
    [ '&', '<', '>' ] =>
    [ '&amp;', '&lt;', '&gt;' ]
);

Grammars

Predefined Rules

Are listed here.

grammar methods

token rule regex

all slang variables


Intro    Chapter:   0. History   1. Design   2. Basic   3. Var   4. Op   5. IO   6. Block   7. Sub   8. OOP   9. Regex   10. Meta
Overview   Appendix:   A. Index   B. Grouped   C. Classtree   D. Delta   E. Exciting   F. FAQ   G. Glossary   H. Href