Changeset 3539
- Timestamp:
- 05/21/05 00:01:59 (4 years ago)
- svk:copy_cache_prev:
- 5107
- Files:
-
- 1 modified
-
docs/quickref/rules (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
docs/quickref/rules
r3519 r3539 8 8 String Stringifies to entire match 9 9 Number The numeric value of the matched string (i.e. given 10 "foo123bar"~~/\d+/, then $/ in numeric context will be 123)10 "foo123bar"~~/\d+/, then $/ in numeric context will be 123) 11 11 Boolean True if success, false otherwise 12 12 … … 51 51 52 52 Built-in assertions: 53 <[...]> Matches ... as a character class54 53 <'...'> Matches ... as a literal string 54 <"..."> Matches ... as a literal string (after interpolation) 55 55 <sp> Matches a literal space 56 56 <ws> Matches any sequence of whitespace, like the :w modifier … … 70 70 <self> Matches the same pattern as the current rule 71 71 (useful for recursion) 72 <! pattern> Matches anything which *doesn't* match pattern73 72 <!XXX> Zero width assertion that XXX *doesn't* match at 73 this location 74 74 <alnum> Alphanumeric character 75 75 <alpha> Alphabetic character … … 80 80 <graph> An alphanumeric character or punctuation 81 81 <lower> Lowercase character 82 <print> Printable character -- alphanumeric, punctuation or whitespace 82 <print> Printable character -- alphanumeric, punctuation or 83 whitespace 83 84 <space> Whitespace character ([\s\ck]) 84 85 <upper> Uppercase character 85 86 <word> Word character (alphanumeric + _) 86 87 <xdigit> Hexadecimal digit 88 89 Named rules are stored in the match object unless the rule name is 90 prefixed with a ? 91 92 /<?item> <quantity> <price>/ 93 94 would store values in $/{'quantity'} and $/{'price'} but not $/{'item'} 95 96 Character classes: 97 <[abcd]> Matches one of the characters a,b,c, or d. Ranges 98 may be used as <[a..z]>. Can be combined with + 99 and - like so: <[a..z]-[m..p]> (which is the same 100 as <[a..l]+[q..z]>) 101 <-XXX> Matches XXX as a negated character class. For 102 instance, <-alpha> would match one non-alpha 103 character. May also be combined as above. 104 (<-alpha+[qrst]> will match any non-alpha character 105 and the characters q,r,s, and t) 106 <+XXX> Matches XXX as a character class. <+alpha> matches 107 one alpha character. 87 108 88 109 Hypothetical variables: … … 112 133 113 134 / %x := [ (\S+)\: \s* (.*) ]* / # key/value pairs 114 # $ 1= list of keys115 # $ 2= list of values135 # $0 = list of keys 136 # $1 = list of values 116 137 117 138 / %x := [ (\S+) \s* ]* / # capture only keys, values = undef
