Change readme formatting
This commit is contained in:
parent
c70a9932b9
commit
d407282e35
1 changed files with 8 additions and 8 deletions
|
|
@ -21,10 +21,10 @@ provides in its standard library is inadequate:
|
||||||
|
|
||||||
== Documentation
|
== Documentation
|
||||||
|
|
||||||
=== Procedures
|
=== Operations
|
||||||
|
|
||||||
[[proc-match]]
|
[[proc-match]]
|
||||||
==== `match(string, Regex, start = 0, endpos = -1): RegexMatch`
|
==== match(string, Regex, start = 0, endpos = -1): RegexMatch
|
||||||
|
|
||||||
Tries to match the pattern, starting at start. This means that
|
Tries to match the pattern, starting at start. This means that
|
||||||
`"foo".match(re"f") == true`, but `"foo".match(re"o") == false`.
|
`"foo".match(re"f") == true`, but `"foo".match(re"o") == false`.
|
||||||
|
|
@ -35,14 +35,14 @@ Tries to match the pattern, starting at start. This means that
|
||||||
otherwise it's an exclusive upper bound.
|
otherwise it's an exclusive upper bound.
|
||||||
|
|
||||||
[[proc-find]]
|
[[proc-find]]
|
||||||
==== `find(string, Regex, start = 0, endpos = -1): RegexMatch`
|
==== find(string, Regex, start = 0, endpos = -1): RegexMatch
|
||||||
|
|
||||||
Finds the given pattern in the string. Bounds work the same as for
|
Finds the given pattern in the string. Bounds work the same as for
|
||||||
link:#proc-match[`match(...)`], but instead of being anchored to the start of
|
link:#proc-match[`match(...)`], but instead of being anchored to the start of
|
||||||
the string, it can match at any point between `start` and `endpos`.
|
the string, it can match at any point between `start` and `endpos`.
|
||||||
|
|
||||||
[[iter-find]]
|
[[iter-find]]
|
||||||
==== `findIter(string, Regex, start = 0, endpos = -1): RegexMatch`
|
==== findIter(string, Regex, start = 0, endpos = -1): RegexMatch
|
||||||
|
|
||||||
Works the same as link:#proc-find[`find(...)`], but finds every non-overlapping
|
Works the same as link:#proc-find[`find(...)`], but finds every non-overlapping
|
||||||
match. `"2222".find(re"22")` is `"22", "22"`, not `"22", "22", "22"`.
|
match. `"2222".find(re"22")` is `"22", "22"`, not `"22", "22", "22"`.
|
||||||
|
|
@ -55,7 +55,7 @@ Variants:
|
||||||
- `findAllStr(...)` returns a `seq[string]`
|
- `findAllStr(...)` returns a `seq[string]`
|
||||||
|
|
||||||
[[proc-split]]
|
[[proc-split]]
|
||||||
==== `split(string, Regex): seq[string]`
|
==== split(string, Regex): seq[string]
|
||||||
|
|
||||||
Splits the string with the given regex. This works according to the rules that
|
Splits the string with the given regex. This works according to the rules that
|
||||||
Perl and Javascript use.
|
Perl and Javascript use.
|
||||||
|
|
@ -66,7 +66,7 @@ Perl and Javascript use.
|
||||||
`"12".split(re"(\d)") == @["", "1", "", "2", ""]`.
|
`"12".split(re"(\d)") == @["", "1", "", "2", ""]`.
|
||||||
|
|
||||||
[[proc-replace]]
|
[[proc-replace]]
|
||||||
==== `replace(string, Regex, sub): string`
|
==== replace(string, Regex, sub): string
|
||||||
|
|
||||||
Replaces each match of Regex in the string with `sub`.
|
Replaces each match of Regex in the string with `sub`.
|
||||||
|
|
||||||
|
|
@ -77,7 +77,7 @@ If `sub` is a string, then each match is replaced with that string, where the
|
||||||
captures are accessable as `$1`, `$2`, and so on. A literal `$` can be added by
|
captures are accessable as `$1`, `$2`, and so on. A literal `$` can be added by
|
||||||
doubling up like so: `$$`.
|
doubling up like so: `$$`.
|
||||||
|
|
||||||
=== `RegexMatch`
|
=== RegexMatch
|
||||||
|
|
||||||
Represents the result of an execution. On failure, it is `nil`. The available
|
Represents the result of an execution. On failure, it is `nil`. The available
|
||||||
fields are as follows:
|
fields are as follows:
|
||||||
|
|
@ -104,7 +104,7 @@ is inclusive.
|
||||||
as a key.
|
as a key.
|
||||||
`(captureBounds|capture).toSeq` :: returns all the captures by their number.
|
`(captureBounds|capture).toSeq` :: returns all the captures by their number.
|
||||||
|
|
||||||
=== `Pattern`
|
=== Pattern
|
||||||
|
|
||||||
Represents the pattern that things are matched against, constructed with
|
Represents the pattern that things are matched against, constructed with
|
||||||
`initRegex(string)` or `re(string)`. Examples: `re"foo"`, `re(r"foo # comment",
|
`initRegex(string)` or `re(string)`. Examples: `re"foo"`, `re(r"foo # comment",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue