|
|
@ -114,6 +114,12 @@ Another, more subtle example is the following regex:
|
|
|
|
x|xx
|
|
|
|
x|xx
|
|
|
|
|
|
|
|
|
|
|
|
While the stdlib implementation (and most other engines) will prefer matching the first item of the alternation,
|
|
|
|
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.
|
|
|
|
this engine will _always_ go for the longest possible match, regardless of the order of the alternation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Byte-slices and runes:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
My engine does not support byte-slices. When a matching function receives a string, it converts it into a
|
|
|
|
|
|
|
|
rune-slice to iterate through it. While this has some space overhead, the convenience of built-in unicode
|
|
|
|
|
|
|
|
support made the tradeoff worth it.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
package regex
|
|
|
|
package regex
|
|
|
|