Updated documentation
This commit is contained in:
22
regex/doc.go
22
regex/doc.go
@@ -95,9 +95,25 @@ Numeric ranges:
|
||||
|
||||
<x-y> Match any number from x to y (inclusive) (x and y must be positive numbers)
|
||||
|
||||
# Flags
|
||||
# Key Differences with regexp
|
||||
|
||||
Flags are used to change the behavior of the engine. None of them are enabled by default. They are passed as variadic arguments to [Compile].
|
||||
The list of flags is provided in the type definition for [ReFlag].
|
||||
The engine and the API differ from [regexp] in a number of ways, some of them very subtle.
|
||||
The key differences are mentioned below.
|
||||
|
||||
Greediness:
|
||||
|
||||
This engine does not support non-greedy operators. All operators are always greedy in nature, and will try
|
||||
to match as much as they can, while still allowing for a successful match. For example, given the regex:
|
||||
|
||||
y*y
|
||||
|
||||
The engine will match as many 'y's as it can, while still allowing the trailing 'y' to be matched.
|
||||
|
||||
Another, more subtle example is the following regex:
|
||||
|
||||
x|xx
|
||||
|
||||
While the stdlib implementation (and most other engines) will prefer matching the first item of the alternation,
|
||||
my engine will _always_ go for the longest possible match, regardless of the order of the alternation.
|
||||
*/
|
||||
package regex
|
||||
|
Reference in New Issue
Block a user