diff --git a/glide.lock b/glide.lock deleted file mode 100644 index 8041dd3..0000000 --- a/glide.lock +++ /dev/null @@ -1,30 +0,0 @@ -hash: f15dd0f525b219a8293a34b41efb693e0bae11e36ee9e0347de4d4d554bfe249 -updated: 2017-12-21T10:57:37.283236038-08:00 -imports: -- name: github.com/dlclark/regexp2 - version: 4009c9dc49dd8906bfd4d479c255470d6a477ce5 - subpackages: - - syntax -- name: github.com/fatih/color - version: 34e4ee095d12986a2cef5ddb9aeb3b8cfcfea17c -- name: github.com/gogo/protobuf - version: 100ba4e885062801d56799d78530b73b178a78f3 - subpackages: - - proto -- name: github.com/mattn/go-colorable - version: d228849504861217f796da67fae4f6e347643f15 -- name: github.com/mattn/go-isatty - version: 30a891c33c7cde7b02a981314b4228ec99380cca -- name: golang.org/x/sys - version: e48874b42435b4347fc52bdee0424a52abc974d7 - subpackages: - - unix -- name: gopkg.in/yaml.v2 - version: a5b47d31c556af34a302ce5d659e6fea44d90de0 -- name: sourcegraph.com/sourcegraph/go-diff - version: 3f415a150aec0685cb81b73cc201e762e075006d - subpackages: - - diff -- name: sourcegraph.com/sqs/pbtypes - version: 4d1b9dc7ffc3f7b555de9b02055fa616f0ebcd18 -testImports: [] diff --git a/glide.yaml b/glide.yaml deleted file mode 100644 index 9eb0107..0000000 --- a/glide.yaml +++ /dev/null @@ -1,11 +0,0 @@ -package: github.com/ezekg/git-hound -import: -- package: github.com/dlclark/regexp2 - version: v1.1.1 -- package: github.com/fatih/color - version: v1.2 -- package: gopkg.in/yaml.v2 -- package: sourcegraph.com/sourcegraph/go-diff - version: 3f415a150aec0685cb81b73cc201e762e075006d - subpackages: - - diff diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2408f1b --- /dev/null +++ b/go.mod @@ -0,0 +1,15 @@ +module github.com/ezekg/git-hound + +go 1.15 + +require ( + github.com/dlclark/regexp2 v1.1.1 + github.com/fatih/color v1.1.1-0.20170103160630-34e4ee095d12 + github.com/gogo/protobuf v0.0.0-20170307180453-100ba4e88506 + github.com/mattn/go-colorable v0.0.7 + github.com/mattn/go-isatty v0.0.0-20161123143637-30a891c33c7c + golang.org/x/sys v0.0.0-20170303135930-e48874b42435 + gopkg.in/yaml.v2 v2.0.0-20160928153709-a5b47d31c556 + sourcegraph.com/sourcegraph/go-diff v0.0.0-20171119081133-3f415a150aec + sourcegraph.com/sqs/pbtypes v0.0.0-20160107090929-4d1b9dc7ffc3 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..983e53d --- /dev/null +++ b/go.sum @@ -0,0 +1,17 @@ +github.com/dlclark/regexp2 v1.1.1 h1:/ABn3mAhHTzHd5qE3S6gaCypX1ou5yQYGo2I7oq/E54= +github.com/dlclark/regexp2 v1.1.1/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/fatih/color v1.1.1-0.20170103160630-34e4ee095d12 h1:AmfUkJtRbNpji0BZS+j+iGOKMu/ttcajZDHXWEn5Qrg= +github.com/fatih/color v1.1.1-0.20170103160630-34e4ee095d12/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/gogo/protobuf v0.0.0-20170307180453-100ba4e88506 h1:zDlw+wgyXdfkRuvFCdEDUiPLmZp2cvf/dWHazY0a5VM= +github.com/gogo/protobuf v0.0.0-20170307180453-100ba4e88506/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/mattn/go-colorable v0.0.7 h1:zh4kz16dcPG+l666m12h0+dO2HGnQ1ngy7crMErE2UU= +github.com/mattn/go-colorable v0.0.7/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.0-20161123143637-30a891c33c7c h1:YHHK/dEmr2Jo1cWD1VMB2waEeHJhHFp3CEylwWy/VcY= +github.com/mattn/go-isatty v0.0.0-20161123143637-30a891c33c7c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +golang.org/x/sys v0.0.0-20170303135930-e48874b42435/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +gopkg.in/yaml.v2 v2.0.0-20160928153709-a5b47d31c556 h1:hKXbLW5oaJoQgs8KrzTLdF4PoHi+0oQPgea9TNtvE3E= +gopkg.in/yaml.v2 v2.0.0-20160928153709-a5b47d31c556/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +sourcegraph.com/sourcegraph/go-diff v0.0.0-20171119081133-3f415a150aec h1:wAAdENPXC7bE1oxY4VqSDdhaA+XQ8TgQHsZMMnrXjEk= +sourcegraph.com/sourcegraph/go-diff v0.0.0-20171119081133-3f415a150aec/go.mod h1:R09mWeb9JcPbO+A3cYDc11xjz0wp6r9+KnqdqROAoRU= +sourcegraph.com/sqs/pbtypes v0.0.0-20160107090929-4d1b9dc7ffc3 h1:hXy8YsgVLDz5mlngKhNHQhAsAGrSp3dlXZN4b0/4UUI= +sourcegraph.com/sqs/pbtypes v0.0.0-20160107090929-4d1b9dc7ffc3/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/vendor/github.com/dlclark/regexp2/.DS_Store b/vendor/github.com/dlclark/regexp2/.DS_Store deleted file mode 100644 index 2575c69..0000000 Binary files a/vendor/github.com/dlclark/regexp2/.DS_Store and /dev/null differ diff --git a/vendor/github.com/dlclark/regexp2/.gitignore b/vendor/github.com/dlclark/regexp2/.gitignore deleted file mode 100644 index 38a7add..0000000 --- a/vendor/github.com/dlclark/regexp2/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof -*.out \ No newline at end of file diff --git a/vendor/github.com/dlclark/regexp2/.travis.yml b/vendor/github.com/dlclark/regexp2/.travis.yml deleted file mode 100644 index a24aede..0000000 --- a/vendor/github.com/dlclark/regexp2/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: go - -go: - - 1.5 - - tip \ No newline at end of file diff --git a/vendor/github.com/dlclark/regexp2/ATTRIB b/vendor/github.com/dlclark/regexp2/ATTRIB deleted file mode 100644 index 5ea795f..0000000 --- a/vendor/github.com/dlclark/regexp2/ATTRIB +++ /dev/null @@ -1,54 +0,0 @@ -============ -Some of this code is ported from dotnet/corefx, which was released under this license: - -The MIT License (MIT) - -Copyright (c) Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -============ -Small pieces of code are copied from the Go framework under this license: - -Copyright (c) 2012 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/github.com/dlclark/regexp2/LICENSE b/vendor/github.com/dlclark/regexp2/LICENSE deleted file mode 100644 index fe83dfd..0000000 --- a/vendor/github.com/dlclark/regexp2/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Doug Clark - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/dlclark/regexp2/README.md b/vendor/github.com/dlclark/regexp2/README.md deleted file mode 100644 index c1f2c8e..0000000 --- a/vendor/github.com/dlclark/regexp2/README.md +++ /dev/null @@ -1,67 +0,0 @@ -#regexp2 - full featured regular expressions for Go -Regexp2 is a feature-rich RegExp engine for Go. It doesn't have constant time guarantees like the built-in `regexp` package, but it allows backtracking and is compatible with Perl5 and .NET. You'll likely be better off with the RE2 engine from the 'regexp' package and should only use this if you need to write very complex patterns or require compatibility with .NET. - -## Basis of the engine -The engine is ported from the .NET framework's System.Text.RegularExpressions.Regex engine. That engine was open sourced in 2015 under the MIT license. There are some fundamental differences between .NET strings and Go strings that required a bit of borrowing from the Go framework regex engine as well. I cleaned up a couple of the dirtier bits during the port (regexcharclass.cs was terrible), but the parse tree, code emmitted, and therefore patterns matched should be identical. - -## Installing -This is a go-gettable library, so install is easy: - - go get github.com/dlclark/regexp2/... - -## Usage -Usage is similar to the Go `regexp` package. Just like in `regexp`, you start by converting a regex into a state machine via the `Compile` or `MustCompile` methods. They ultimately do the same thing, but `MustCompile` will panic if the regex is invalid. You can then use the provided Regexp struct to find matches repeatedly. A `Regexp` struct is safe to use across goroutines. - -```go -re := regexp2.MustCompile(`Your pattern`, 0) -if isMatch, _ := re.MatchString(`Something to match`); isMatch { - //do something -} -``` - -The only error that the `*Match*` methods *should* return is a Timeout if you set the `re.MatchTimeout` field. Any other error is a bug in the `regexp2` package. If you need more details about capture groups in a match then use the `FindStringMatch` method, like so: - -```go -if m, _ := re.FindStringMatch(`Something to match`); m != nil { - // the whole match is always group 0 - fmt.Printf("Group 0: %v\n", m.String()) - - // you can get all the groups too - gps := m.Groups() - - // a group can be captured multiple times, so each cap is separately addressable - fmt.Printf("Group 1, first capture", gps[1].Captures[0].String()) - fmt.Printf("Group 1, second capture", gps[1].Captures[1].String()) -} -``` - -Group 0 is embedded in the Match. Group 0 is an automatically-assigned group that encompasses the whole pattern. This means that `m.String()` is the same as `m.Group.String()` and `m.Groups()[0].String()` - -The __last__ capture is embedded in each group, so `g.String()` will return the same thing as `g.Capture.String()` and `g.Captures[len(g.Captures)-1].String()`. - -## Compare `regexp` and `regexp2` -| Category | regexp | regexp2 | -| --- | --- | --- | -| Catastrophic backtracking possible | no, constant execution time guarantees | yes, if your pattern is at risk you can use the `re.MatchTimeout` field | -| Python-style capture groups `(Pre)` | yes | no | -| .NET-style capture groups `(re)` or `('name're)` | no | yes | -| comments `(?#comment)` | no | yes | -| branch numbering reset `(?\|a\|b)` | no | no | -| possessive match `(?>re)` | no | yes | -| positive lookahead `(?=re)` | no | yes | -| negative lookahead `(?!re)` | no | yes | -| positive lookbehind `(?<=re)` | no | yes | -| negative lookbehind `(? 0 && m.matches[cap][m.matchcount[cap]*2-1] != (-3+1) -} - -// matchIndex returns the index of the last specified matched group by capnum -func (m *Match) matchIndex(cap int) int { - i := m.matches[cap][m.matchcount[cap]*2-2] - if i >= 0 { - return i - } - - return m.matches[cap][-3-i] -} - -// matchLength returns the length of the last specified matched group by capnum -func (m *Match) matchLength(cap int) int { - i := m.matches[cap][m.matchcount[cap]*2-1] - if i >= 0 { - return i - } - - return m.matches[cap][-3-i] -} - -// Nonpublic builder: add a capture to the group specified by "c" -func (m *Match) addMatch(c, start, l int) { - - if m.matches[c] == nil { - m.matches[c] = make([]int, 2) - } - - capcount := m.matchcount[c] - - if capcount*2+2 > len(m.matches[c]) { - oldmatches := m.matches[c] - newmatches := make([]int, capcount*8) - copy(newmatches, oldmatches[:capcount*2]) - m.matches[c] = newmatches - } - - m.matches[c][capcount*2] = start - m.matches[c][capcount*2+1] = l - m.matchcount[c] = capcount + 1 - //log.Printf("addMatch: c=%v, i=%v, l=%v ... matches: %v", c, start, l, m.matches) -} - -// Nonpublic builder: Add a capture to balance the specified group. This is used by the -// balanced match construct. (?...) -// -// If there were no such thing as backtracking, this would be as simple as calling RemoveMatch(c). -// However, since we have backtracking, we need to keep track of everything. -func (m *Match) balanceMatch(c int) { - m.balancing = true - - // we'll look at the last capture first - capcount := m.matchcount[c] - target := capcount*2 - 2 - - // first see if it is negative, and therefore is a reference to the next available - // capture group for balancing. If it is, we'll reset target to point to that capture. - if m.matches[c][target] < 0 { - target = -3 - m.matches[c][target] - } - - // move back to the previous capture - target -= 2 - - // if the previous capture is a reference, just copy that reference to the end. Otherwise, point to it. - if target >= 0 && m.matches[c][target] < 0 { - m.addMatch(c, m.matches[c][target], m.matches[c][target+1]) - } else { - m.addMatch(c, -3-target, -4-target /* == -3 - (target + 1) */) - } -} - -// Nonpublic builder: removes a group match by capnum -func (m *Match) removeMatch(c int) { - m.matchcount[c]-- -} - -// GroupCount returns the number of groups this match has matched -func (m *Match) GroupCount() int { - return len(m.matchcount) -} - -// GroupByName returns a group based on the name of the group, or nil if the group name does not exist -func (m *Match) GroupByName(name string) *Group { - num := m.regex.GroupNumberFromName(name) - if num < 0 { - return nil - } - return m.GroupByNumber(num) -} - -// GroupByNumber returns a group based on the number of the group, or nil if the group number does not exist -func (m *Match) GroupByNumber(num int) *Group { - // check our sparse map - if m.sparseCaps != nil { - if newNum, ok := m.sparseCaps[num]; ok { - num = newNum - } - } - if num >= len(m.matchcount) || num < 0 { - return nil - } - - if num == 0 { - return &m.Group - } - - m.populateOtherGroups() - - return &m.otherGroups[num-1] -} - -// Groups returns all the capture groups, starting with group 0 (the full match) -func (m *Match) Groups() []Group { - m.populateOtherGroups() - g := make([]Group, len(m.otherGroups)+1) - g[0] = m.Group - copy(g[1:], m.otherGroups) - return g -} - -func (m *Match) populateOtherGroups() { - // Construct all the Group objects first time called - if m.otherGroups == nil { - m.otherGroups = make([]Group, len(m.matchcount)-1) - for i := 0; i < len(m.otherGroups); i++ { - m.otherGroups[i] = newGroup(m.regex.GroupNameFromNumber(i+1), m.text, m.matches[i+1], m.matchcount[i+1]) - } - } -} - -func (m *Match) groupValueAppendToBuf(groupnum int, buf *bytes.Buffer) { - c := m.matchcount[groupnum] - if c == 0 { - return - } - - matches := m.matches[groupnum] - - index := matches[(c-1)*2] - last := index + matches[(c*2)-1] - - for ; index < last; index++ { - buf.WriteRune(m.text[index]) - } -} - -func newGroup(name string, text []rune, caps []int, capcount int) Group { - g := Group{} - g.text = text - if capcount > 0 { - g.Index = caps[(capcount-1)*2] - g.Length = caps[(capcount*2)-1] - } - g.Name = name - g.Captures = make([]Capture, capcount) - for i := 0; i < capcount; i++ { - g.Captures[i] = Capture{ - text: text, - Index: caps[i*2], - Length: caps[i*2+1], - } - } - //log.Printf("newGroup! capcount %v, %+v", capcount, g) - - return g -} - -func (m *Match) dump() string { - buf := &bytes.Buffer{} - buf.WriteRune('\n') - if len(m.sparseCaps) > 0 { - for k, v := range m.sparseCaps { - fmt.Fprintf(buf, "Slot %v -> %v\n", k, v) - } - } - - for i, g := range m.Groups() { - fmt.Fprintf(buf, "Group %v (%v), %v caps:\n", i, g.Name, len(g.Captures)) - - for _, c := range g.Captures { - fmt.Fprintf(buf, " (%v, %v) %v\n", c.Index, c.Length, c.String()) - } - } - /* - for i := 0; i < len(m.matchcount); i++ { - fmt.Fprintf(buf, "\nGroup %v (%v):\n", i, m.regex.GroupNameFromNumber(i)) - - for j := 0; j < m.matchcount[i]; j++ { - text := "" - - if m.matches[i][j*2] >= 0 { - start := m.matches[i][j*2] - text = m.text[start : start+m.matches[i][j*2+1]] - } - - fmt.Fprintf(buf, " (%v, %v) %v\n", m.matches[i][j*2], m.matches[i][j*2+1], text) - } - } - */ - return buf.String() -} diff --git a/vendor/github.com/dlclark/regexp2/regexp.go b/vendor/github.com/dlclark/regexp2/regexp.go deleted file mode 100644 index ea7e775..0000000 --- a/vendor/github.com/dlclark/regexp2/regexp.go +++ /dev/null @@ -1,357 +0,0 @@ -/* -Package regexp2 is a regexp package that has an interface similar to Go's framework regexp engine but uses a -more feature full regex engine behind the scenes. - -It doesn't have constant time guarantees, but it allows backtracking and is compatible with Perl5 and .NET. -You'll likely be better off with the RE2 engine from the regexp package and should only use this if you -need to write very complex patterns or require compatibility with .NET. -*/ -package regexp2 - -import ( - "errors" - "math" - "strconv" - "sync" - "time" - - "github.com/dlclark/regexp2/syntax" -) - -// Default timeout used when running regexp matches -- "forever" -var DefaultMatchTimeout = time.Duration(math.MaxInt64) - -// Regexp is the representation of a compiled regular expression. -// A Regexp is safe for concurrent use by multiple goroutines. -type Regexp struct { - //timeout when trying to find matches - MatchTimeout time.Duration - - // read-only after Compile - pattern string // as passed to Compile - options RegexOptions // options - - caps map[int]int // capnum->index - capnames map[string]int //capture group name -> index - capslist []string //sorted list of capture group names - capsize int // size of the capture array - - code *syntax.Code // compiled program - - // cache of machines for running regexp - muRun sync.Mutex - runner []*runner -} - -// Compile parses a regular expression and returns, if successful, -// a Regexp object that can be used to match against text. -func Compile(expr string, opt RegexOptions) (*Regexp, error) { - // parse it - tree, err := syntax.Parse(expr, syntax.RegexOptions(opt)) - if err != nil { - return nil, err - } - - // translate it to code - code, err := syntax.Write(tree) - if err != nil { - return nil, err - } - - // return it - return &Regexp{ - pattern: expr, - options: opt, - caps: code.Caps, - capnames: tree.Capnames, - capslist: tree.Caplist, - capsize: code.Capsize, - code: code, - MatchTimeout: DefaultMatchTimeout, - }, nil -} - -// MustCompile is like Compile but panics if the expression cannot be parsed. -// It simplifies safe initialization of global variables holding compiled regular -// expressions. -func MustCompile(str string, opt RegexOptions) *Regexp { - regexp, error := Compile(str, opt) - if error != nil { - panic(`regexp2: Compile(` + quote(str) + `): ` + error.Error()) - } - return regexp -} - -// Escape adds backslashes to any special characters in the input string -func Escape(input string) string { - return syntax.Escape(input) -} - -// Unescape removes any backslashes from previously-escaped special characters in the input string -func Unescape(input string) (string, error) { - return syntax.Unescape(input) -} - -// String returns the source text used to compile the regular expression. -func (re *Regexp) String() string { - return re.pattern -} - -func quote(s string) string { - if strconv.CanBackquote(s) { - return "`" + s + "`" - } - return strconv.Quote(s) -} - -// RegexOptions impact the runtime and parsing behavior -// for each specific regex. They are setable in code as well -// as in the regex pattern itself. -type RegexOptions int32 - -const ( - None RegexOptions = 0x0 - IgnoreCase = 0x0001 // "i" - Multiline = 0x0002 // "m" - ExplicitCapture = 0x0004 // "n" - Compiled = 0x0008 // "c" - Singleline = 0x0010 // "s" - IgnorePatternWhitespace = 0x0020 // "x" - RightToLeft = 0x0040 // "r" - Debug = 0x0080 // "d" - ECMAScript = 0x0100 // "e" -) - -func (re *Regexp) RightToLeft() bool { - return re.options&RightToLeft != 0 -} - -func (re *Regexp) Debug() bool { - return re.options&Debug != 0 -} - -// Replace searches the input string and replaces each match found with the replacement text. -// Count will limit the number of matches attempted and startAt will allow -// us to skip past possible matches at the start of the input (left or right depending on RightToLeft option). -// Set startAt and count to -1 to go through the whole string -func (re *Regexp) Replace(input, replacement string, startAt, count int) (string, error) { - data, err := syntax.NewReplacerData(replacement, re.caps, re.capsize, re.capnames, syntax.RegexOptions(re.options)) - if err != nil { - return "", err - } - //TODO: cache ReplacerData - - return replace(re, data, nil, input, startAt, count) -} - -// ReplaceFunc searches the input string and replaces each match found using the string from the evaluator -// Count will limit the number of matches attempted and startAt will allow -// us to skip past possible matches at the start of the input (left or right depending on RightToLeft option). -// Set startAt and count to -1 to go through the whole string. -func (re *Regexp) ReplaceFunc(input string, evaluator MatchEvaluator, startAt, count int) (string, error) { - return replace(re, nil, evaluator, input, startAt, count) -} - -// FindStringMatch searches the input string for a Regexp match -func (re *Regexp) FindStringMatch(s string) (*Match, error) { - // convert string to runes - return re.run(false, -1, getRunes(s)) -} - -// FindRunesMatch searches the input rune slice for a Regexp match -func (re *Regexp) FindRunesMatch(r []rune) (*Match, error) { - return re.run(false, -1, r) -} - -// FindStringMatchStartingAt searches the input string for a Regexp match starting at the startAt index -func (re *Regexp) FindStringMatchStartingAt(s string, startAt int) (*Match, error) { - if startAt > len(s) { - return nil, errors.New("startAt must be less than the length of the input string") - } - r, startAt := re.getRunesAndStart(s, startAt) - if startAt == -1 { - // we didn't find our start index in the string -- that's a problem - return nil, errors.New("startAt must align to the start of a valid rune in the input string") - } - - return re.run(false, startAt, r) -} - -// FindRunesMatchStartingAt searches the input rune slice for a Regexp match starting at the startAt index -func (re *Regexp) FindRunesMatchStartingAt(r []rune, startAt int) (*Match, error) { - return re.run(false, startAt, r) -} - -// FindNextMatch returns the next match in the same input string as the match parameter. -// Will return nil if there is no next match or if given a nil match. -func (re *Regexp) FindNextMatch(m *Match) (*Match, error) { - if m == nil { - return nil, nil - } - - // If previous match was empty, advance by one before matching to prevent - // infinite loop - startAt := m.textpos - if m.Length == 0 { - if m.textpos == len(m.text) { - return nil, nil - } - - if re.RightToLeft() { - startAt-- - } else { - startAt++ - } - } - return re.run(false, startAt, m.text) -} - -// MatchString return true if the string matches the regex -// error will be set if a timeout occurs -func (re *Regexp) MatchString(s string) (bool, error) { - m, err := re.run(true, -1, getRunes(s)) - if err != nil { - return false, err - } - return m != nil, nil -} - -func (re *Regexp) getRunesAndStart(s string, startAt int) ([]rune, int) { - if startAt < 0 { - if re.RightToLeft() { - r := getRunes(s) - return r, len(r) - } - return getRunes(s), 0 - } - ret := make([]rune, len(s)) - i := 0 - runeIdx := -1 - for strIdx, r := range s { - if strIdx == startAt { - runeIdx = i - } - ret[i] = r - i++ - } - return ret[:i], runeIdx -} - -func getRunes(s string) []rune { - ret := make([]rune, len(s)) - i := 0 - for _, r := range s { - ret[i] = r - i++ - } - return ret[:i] -} - -// MatchRunes return true if the runes matches the regex -// error will be set if a timeout occurs -func (re *Regexp) MatchRunes(r []rune) (bool, error) { - m, err := re.run(true, -1, r) - if err != nil { - return false, err - } - return m != nil, nil -} - -// GetGroupNames Returns the set of strings used to name capturing groups in the expression. -func (re *Regexp) GetGroupNames() []string { - var result []string - - if re.capslist == nil { - result = make([]string, re.capsize) - - for i := 0; i < re.capsize; i++ { - result[i] = strconv.Itoa(i) - } - } else { - result = make([]string, len(re.capslist)) - copy(result, re.capslist) - } - - return result -} - -// GetGroupNumbers returns the integer group numbers corresponding to a group name. -func (re *Regexp) GetGroupNumbers() []int { - var result []int - - if re.caps == nil { - result = make([]int, re.capsize) - - for i := 0; i < re.capsize; i++ { - result[i] = i - } - } else { - result = make([]int, len(re.caps)) - - for k, v := range re.caps { - result[v] = k - } - } - - return result -} - -// GroupNameFromNumber retrieves a group name that corresponds to a group number. -// It will return "" for and unknown group number. Unnamed groups automatically -// receive a name that is the decimal string equivalent of its number. -func (re *Regexp) GroupNameFromNumber(i int) string { - if re.capslist == nil { - if i >= 0 && i < re.capsize { - return strconv.Itoa(i) - } - - return "" - } - - if re.caps != nil { - var ok bool - if i, ok = re.caps[i]; !ok { - return "" - } - } - - if i >= 0 && i < len(re.capslist) { - return re.capslist[i] - } - - return "" -} - -// GroupNumberFromName returns a group number that corresponds to a group name. -// Returns -1 if the name is not a recognized group name. Numbered groups -// automatically get a group name that is the decimal string equivalent of its number. -func (re *Regexp) GroupNumberFromName(name string) int { - // look up name if we have a hashtable of names - if re.capnames != nil { - if k, ok := re.capnames[name]; ok { - return k - } - - return -1 - } - - // convert to an int if it looks like a number - result := 0 - for i := 0; i < len(name); i++ { - ch := name[i] - - if ch > '9' || ch < '0' { - return -1 - } - - result *= 10 - result += int(ch - '0') - } - - // return int if it's in range - if result >= 0 && result < re.capsize { - return result - } - - return -1 -} diff --git a/vendor/github.com/dlclark/regexp2/regexp_mono_test.go b/vendor/github.com/dlclark/regexp2/regexp_mono_test.go deleted file mode 100644 index 372e81c..0000000 --- a/vendor/github.com/dlclark/regexp2/regexp_mono_test.go +++ /dev/null @@ -1,1081 +0,0 @@ -package regexp2 - -import ( - "fmt" - "testing" -) - -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -// https://github.com/mono/mono/blob/master/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs -// ported from perl-5.6.1/t/op/re_tests - -func TestMono_Basics(t *testing.T) { - runRegexTrial(t, `abc`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `abc`, 0, "xbc", "Fail.") - runRegexTrial(t, `abc`, 0, "axc", "Fail.") - runRegexTrial(t, `abc`, 0, "abx", "Fail.") - runRegexTrial(t, `abc`, 0, "xabcy", "Pass. Group[0]=(1,3)") - runRegexTrial(t, `abc`, 0, "ababc", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `ab*c`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab*bc`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab*bc`, 0, "abbc", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `ab*bc`, 0, "abbbbc", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `.{1}`, 0, "abbbbc", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `.{3,4}`, 0, "abbbbc", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `ab{0,}bc`, 0, "abbbbc", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab+bc`, 0, "abbc", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `ab+bc`, 0, "abc", "Fail.") - runRegexTrial(t, `ab+bc`, 0, "abq", "Fail.") - runRegexTrial(t, `ab{1,}bc`, 0, "abq", "Fail.") - runRegexTrial(t, `ab+bc`, 0, "abbbbc", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab{1,}bc`, 0, "abbbbc", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab{1,3}bc`, 0, "abbbbc", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab{3,4}bc`, 0, "abbbbc", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab{4,5}bc`, 0, "abbbbc", "Fail.") - runRegexTrial(t, `ab?bc`, 0, "abbc", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `ab?bc`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab{0,1}bc`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab?bc`, 0, "abbbbc", "Fail.") - runRegexTrial(t, `ab?c`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab{0,1}c`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `^abc$`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `^abc$`, 0, "abcc", "Fail.") - runRegexTrial(t, `^abc`, 0, "abcc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `^abc$`, 0, "aabc", "Fail.") - runRegexTrial(t, `abc$`, 0, "aabc", "Pass. Group[0]=(1,3)") - runRegexTrial(t, `abc$`, 0, "aabcd", "Fail.") - runRegexTrial(t, `^`, 0, "abc", "Pass. Group[0]=(0,0)") - runRegexTrial(t, `$`, 0, "abc", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `a.c`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a.c`, 0, "axc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a.*c`, 0, "axyzc", "Pass. Group[0]=(0,5)") - runRegexTrial(t, `a.*c`, 0, "axyzd", "Fail.") - runRegexTrial(t, `a[bc]d`, 0, "abc", "Fail.") - runRegexTrial(t, `a[bc]d`, 0, "abd", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[b-d]e`, 0, "abd", "Fail.") - runRegexTrial(t, `a[b-d]e`, 0, "ace", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[b-d]`, 0, "aac", "Pass. Group[0]=(1,2)") - runRegexTrial(t, `a[-b]`, 0, "a-", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `a[b-]`, 0, "a-", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `a[b-a]`, 0, "-", "Error.") - runRegexTrial(t, `a[]b`, 0, "-", "Error.") - runRegexTrial(t, `a[`, 0, "-", "Error.") - runRegexTrial(t, `a]`, 0, "a]", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `a[]]b`, 0, "a]b", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[^bc]d`, 0, "aed", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[^bc]d`, 0, "abd", "Fail.") - runRegexTrial(t, `a[^-b]c`, 0, "adc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[^-b]c`, 0, "a-c", "Fail.") - runRegexTrial(t, `a[^]b]c`, 0, "a]c", "Fail.") - runRegexTrial(t, `a[^]b]c`, 0, "adc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `\ba\b`, 0, "a-", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `\ba\b`, 0, "-a", "Pass. Group[0]=(1,1)") - runRegexTrial(t, `\ba\b`, 0, "-a-", "Pass. Group[0]=(1,1)") - runRegexTrial(t, `\by\b`, 0, "xy", "Fail.") - runRegexTrial(t, `\by\b`, 0, "yz", "Fail.") - runRegexTrial(t, `\by\b`, 0, "xyz", "Fail.") - runRegexTrial(t, `\Ba\B`, 0, "a-", "Fail.") - runRegexTrial(t, `\Ba\B`, 0, "-a", "Fail.") - runRegexTrial(t, `\Ba\B`, 0, "-a-", "Fail.") - runRegexTrial(t, `\By\b`, 0, "xy", "Pass. Group[0]=(1,1)") - runRegexTrial(t, `\by\B`, 0, "yz", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `\By\B`, 0, "xyz", "Pass. Group[0]=(1,1)") - runRegexTrial(t, `\w`, 0, "a", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `\w`, 0, "-", "Fail.") - runRegexTrial(t, `\W`, 0, "a", "Fail.") - runRegexTrial(t, `\W`, 0, "-", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `a\sb`, 0, "a b", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a\sb`, 0, "a-b", "Fail.") - runRegexTrial(t, `a\Sb`, 0, "a b", "Fail.") - runRegexTrial(t, `a\Sb`, 0, "a-b", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `\d`, 0, "1", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `\d`, 0, "-", "Fail.") - runRegexTrial(t, `\D`, 0, "1", "Fail.") - runRegexTrial(t, `\D`, 0, "-", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `[\w]`, 0, "a", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `[\w]`, 0, "-", "Fail.") - runRegexTrial(t, `[\W]`, 0, "a", "Fail.") - runRegexTrial(t, `[\W]`, 0, "-", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `a[\s]b`, 0, "a b", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[\s]b`, 0, "a-b", "Fail.") - runRegexTrial(t, `a[\S]b`, 0, "a b", "Fail.") - runRegexTrial(t, `a[\S]b`, 0, "a-b", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `[\d]`, 0, "1", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `[\d]`, 0, "-", "Fail.") - runRegexTrial(t, `[\D]`, 0, "1", "Fail.") - runRegexTrial(t, `[\D]`, 0, "-", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `ab|cd`, 0, "abc", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `ab|cd`, 0, "abcd", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `()ef`, 0, "def", "Pass. Group[0]=(1,2) Group[1]=(1,0)") - runRegexTrial(t, `*a`, 0, "-", "Error.") - runRegexTrial(t, `(*)b`, 0, "-", "Error.") - runRegexTrial(t, `$b`, 0, "b", "Fail.") - runRegexTrial(t, `a\`, 0, "-", "Error.") - runRegexTrial(t, `a\(b`, 0, "a(b", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a\(*b`, 0, "ab", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `a\(*b`, 0, "a((b", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `a\\b`, 0, "a\\b", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `abc)`, 0, "-", "Error.") - runRegexTrial(t, `(abc`, 0, "-", "Error.") - runRegexTrial(t, `((a))`, 0, "abc", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1)") - runRegexTrial(t, `(a)b(c)`, 0, "abc", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)") - runRegexTrial(t, `a+b+c`, 0, "aabbabc", "Pass. Group[0]=(4,3)") - runRegexTrial(t, `a{1,}b{1,}c`, 0, "aabbabc", "Pass. Group[0]=(4,3)") - runRegexTrial(t, `a**`, 0, "-", "Error.") - runRegexTrial(t, `a.+?c`, 0, "abcabc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `(a+|b)*`, 0, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)") - runRegexTrial(t, `(a+|b){0,}`, 0, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)") - runRegexTrial(t, `(a+|b)+`, 0, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)") - runRegexTrial(t, `(a+|b){1,}`, 0, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)") - runRegexTrial(t, `(a+|b)?`, 0, "ab", "Pass. Group[0]=(0,1) Group[1]=(0,1)") - runRegexTrial(t, `(a+|b){0,1}`, 0, "ab", "Pass. Group[0]=(0,1) Group[1]=(0,1)") - runRegexTrial(t, `)(`, 0, "-", "Error.") - runRegexTrial(t, `[^ab]*`, 0, "cde", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `abc`, 0, "", "Fail.") - runRegexTrial(t, `a*`, 0, "", "Pass. Group[0]=(0,0)") - runRegexTrial(t, `([abc])*d`, 0, "abbbcd", "Pass. Group[0]=(0,6) Group[1]=(0,1)(1,1)(2,1)(3,1)(4,1)") - runRegexTrial(t, `([abc])*bcd`, 0, "abcd", "Pass. Group[0]=(0,4) Group[1]=(0,1)") - runRegexTrial(t, `a|b|c|d|e`, 0, "e", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `(a|b|c|d|e)f`, 0, "ef", "Pass. Group[0]=(0,2) Group[1]=(0,1)") - runRegexTrial(t, `abcd*efg`, 0, "abcdefg", "Pass. Group[0]=(0,7)") - runRegexTrial(t, `ab*`, 0, "xabyabbbz", "Pass. Group[0]=(1,2)") - runRegexTrial(t, `ab*`, 0, "xayabbbz", "Pass. Group[0]=(1,1)") - runRegexTrial(t, `(ab|cd)e`, 0, "abcde", "Pass. Group[0]=(2,3) Group[1]=(2,2)") - runRegexTrial(t, `[abhgefdc]ij`, 0, "hij", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `^(ab|cd)e`, 0, "abcde", "Fail.") - runRegexTrial(t, `(abc|)ef`, 0, "abcdef", "Pass. Group[0]=(4,2) Group[1]=(4,0)") - runRegexTrial(t, `(a|b)c*d`, 0, "abcd", "Pass. Group[0]=(1,3) Group[1]=(1,1)") - runRegexTrial(t, `(ab|ab*)bc`, 0, "abc", "Pass. Group[0]=(0,3) Group[1]=(0,1)") - runRegexTrial(t, `a([bc]*)c*`, 0, "abc", "Pass. Group[0]=(0,3) Group[1]=(1,2)") - runRegexTrial(t, `a([bc]*)(c*d)`, 0, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)") - runRegexTrial(t, `a([bc]+)(c*d)`, 0, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)") - runRegexTrial(t, `a([bc]*)(c+d)`, 0, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)") - runRegexTrial(t, `a[bcd]*dcdcde`, 0, "adcdcde", "Pass. Group[0]=(0,7)") - runRegexTrial(t, `a[bcd]+dcdcde`, 0, "adcdcde", "Fail.") - runRegexTrial(t, `(ab|a)b*c`, 0, "abc", "Pass. Group[0]=(0,3) Group[1]=(0,2)") - runRegexTrial(t, `((a)(b)c)(d)`, 0, "abcd", "Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]=(0,1) Group[3]=(1,1) Group[4]=(3,1)") - runRegexTrial(t, `[a-zA-Z_][a-zA-Z0-9_]*`, 0, "alpha", "Pass. Group[0]=(0,5)") - runRegexTrial(t, `^a(bc+|b[eh])g|.h$`, 0, "abh", "Pass. Group[0]=(1,2) Group[1]=") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, "effgz", "Pass. Group[0]=(0,5) Group[1]=(0,5) Group[2]=") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, "ij", "Pass. Group[0]=(0,2) Group[1]=(0,2) Group[2]=(1,1)") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, "effg", "Fail.") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, "bcdd", "Fail.") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, 0, "reffgz", "Pass. Group[0]=(1,5) Group[1]=(1,5) Group[2]=") - runRegexTrial(t, `((((((((((a))))))))))`, 0, "a", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)") - runRegexTrial(t, `((((((((((a))))))))))\10`, 0, "aa", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)") - runRegexTrial(t, `((((((((((a))))))))))!`, 0, "aa", "Fail.") - runRegexTrial(t, `((((((((((a))))))))))!`, 0, "a!", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)") - runRegexTrial(t, `(((((((((a)))))))))`, 0, "a", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1)") - runRegexTrial(t, `multiple words of text`, 0, "uh-uh", "Fail.") - runRegexTrial(t, `multiple words`, 0, "multiple words, yeah", "Pass. Group[0]=(0,14)") - runRegexTrial(t, `(.*)c(.*)`, 0, "abcde", "Pass. Group[0]=(0,5) Group[1]=(0,2) Group[2]=(3,2)") - runRegexTrial(t, `\((.*), (.*)\)`, 0, "(a, b)", "Pass. Group[0]=(0,6) Group[1]=(1,1) Group[2]=(4,1)") - runRegexTrial(t, `[k]`, 0, "ab", "Fail.") - runRegexTrial(t, `abcd`, 0, "abcd", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `a(bc)d`, 0, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,2)") - runRegexTrial(t, `a[-]?c`, 0, "ac", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `(abc)\1`, 0, "abcabc", "Pass. Group[0]=(0,6) Group[1]=(0,3)") - runRegexTrial(t, `([a-c]*)\1`, 0, "abcabc", "Pass. Group[0]=(0,6) Group[1]=(0,3)") - runRegexTrial(t, `\1`, 0, "-", "Error.") - runRegexTrial(t, `\2`, 0, "-", "Error.") - runRegexTrial(t, `(a)|\1`, 0, "a", "Pass. Group[0]=(0,1) Group[1]=(0,1)") - runRegexTrial(t, `(a)|\1`, 0, "x", "Fail.") - runRegexTrial(t, `(a)|\2`, 0, "-", "Error.") - runRegexTrial(t, `(([a-c])b*?\2)*`, 0, "ababbbcbc", "Pass. Group[0]=(0,5) Group[1]=(0,3)(3,2) Group[2]=(0,1)(3,1)") - runRegexTrial(t, `(([a-c])b*?\2){3}`, 0, "ababbbcbc", "Pass. Group[0]=(0,9) Group[1]=(0,3)(3,3)(6,3) Group[2]=(0,1)(3,1)(6,1)") - runRegexTrial(t, `((\3|b)\2(a)x)+`, 0, "aaxabxbaxbbx", "Fail.") - runRegexTrial(t, `((\3|b)\2(a)x)+`, 0, "aaaxabaxbaaxbbax", "Pass. Group[0]=(12,4) Group[1]=(12,4) Group[2]=(12,1) Group[3]=(14,1)") - runRegexTrial(t, `((\3|b)\2(a)){2,}`, 0, "bbaababbabaaaaabbaaaabba", "Pass. Group[0]=(15,9) Group[1]=(15,3)(18,3)(21,3) Group[2]=(15,1)(18,1)(21,1) Group[3]=(17,1)(20,1)(23,1)") - runRegexTrial(t, `abc`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `abc`, IgnoreCase, "XBC", "Fail.") - runRegexTrial(t, `abc`, IgnoreCase, "AXC", "Fail.") - runRegexTrial(t, `abc`, IgnoreCase, "ABX", "Fail.") - runRegexTrial(t, `abc`, IgnoreCase, "XABCY", "Pass. Group[0]=(1,3)") - runRegexTrial(t, `abc`, IgnoreCase, "ABABC", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `ab*c`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab*bc`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab*bc`, IgnoreCase, "ABBC", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `ab*?bc`, IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab{0,}?bc`, IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab+?bc`, IgnoreCase, "ABBC", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `ab+bc`, IgnoreCase, "ABC", "Fail.") - runRegexTrial(t, `ab+bc`, IgnoreCase, "ABQ", "Fail.") - runRegexTrial(t, `ab{1,}bc`, IgnoreCase, "ABQ", "Fail.") - runRegexTrial(t, `ab+bc`, IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab{1,}?bc`, IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab{1,3}?bc`, IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab{3,4}?bc`, IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)") - runRegexTrial(t, `ab{4,5}?bc`, IgnoreCase, "ABBBBC", "Fail.") - runRegexTrial(t, `ab??bc`, IgnoreCase, "ABBC", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `ab??bc`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab{0,1}?bc`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab??bc`, IgnoreCase, "ABBBBC", "Fail.") - runRegexTrial(t, `ab??c`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab{0,1}?c`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `^abc$`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `^abc$`, IgnoreCase, "ABCC", "Fail.") - runRegexTrial(t, `^abc`, IgnoreCase, "ABCC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `^abc$`, IgnoreCase, "AABC", "Fail.") - runRegexTrial(t, `abc$`, IgnoreCase, "AABC", "Pass. Group[0]=(1,3)") - runRegexTrial(t, `^`, IgnoreCase, "ABC", "Pass. Group[0]=(0,0)") - runRegexTrial(t, `$`, IgnoreCase, "ABC", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `a.c`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a.c`, IgnoreCase, "AXC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a.*?c`, IgnoreCase, "AXYZC", "Pass. Group[0]=(0,5)") - runRegexTrial(t, `a.*c`, IgnoreCase, "AXYZD", "Fail.") - runRegexTrial(t, `a[bc]d`, IgnoreCase, "ABC", "Fail.") - runRegexTrial(t, `a[bc]d`, IgnoreCase, "ABD", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[b-d]e`, IgnoreCase, "ABD", "Fail.") - runRegexTrial(t, `a[b-d]e`, IgnoreCase, "ACE", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[b-d]`, IgnoreCase, "AAC", "Pass. Group[0]=(1,2)") - runRegexTrial(t, `a[-b]`, IgnoreCase, "A-", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `a[b-]`, IgnoreCase, "A-", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `a[b-a]`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `a[]b`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `a[`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `a]`, IgnoreCase, "A]", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `a[]]b`, IgnoreCase, "A]B", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[^bc]d`, IgnoreCase, "AED", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[^bc]d`, IgnoreCase, "ABD", "Fail.") - runRegexTrial(t, `a[^-b]c`, IgnoreCase, "ADC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a[^-b]c`, IgnoreCase, "A-C", "Fail.") - runRegexTrial(t, `a[^]b]c`, IgnoreCase, "A]C", "Fail.") - runRegexTrial(t, `a[^]b]c`, IgnoreCase, "ADC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `ab|cd`, IgnoreCase, "ABC", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `ab|cd`, IgnoreCase, "ABCD", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `()ef`, IgnoreCase, "DEF", "Pass. Group[0]=(1,2) Group[1]=(1,0)") - runRegexTrial(t, `*a`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `(*)b`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `$b`, IgnoreCase, "B", "Fail.") - runRegexTrial(t, `a\`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `a\(b`, IgnoreCase, "A(B", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a\(*b`, IgnoreCase, "AB", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `a\(*b`, IgnoreCase, "A((B", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `a\\b`, IgnoreCase, "A\\B", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `abc)`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `(abc`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `((a))`, IgnoreCase, "ABC", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1)") - runRegexTrial(t, `(a)b(c)`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)") - runRegexTrial(t, `a+b+c`, IgnoreCase, "AABBABC", "Pass. Group[0]=(4,3)") - runRegexTrial(t, `a{1,}b{1,}c`, IgnoreCase, "AABBABC", "Pass. Group[0]=(4,3)") - runRegexTrial(t, `a**`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `a.+?c`, IgnoreCase, "ABCABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a.*?c`, IgnoreCase, "ABCABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `a.{0,5}?c`, IgnoreCase, "ABCABC", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `(a+|b)*`, IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)") - runRegexTrial(t, `(a+|b){0,}`, IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)") - runRegexTrial(t, `(a+|b)+`, IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)") - runRegexTrial(t, `(a+|b){1,}`, IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)") - runRegexTrial(t, `(a+|b)?`, IgnoreCase, "AB", "Pass. Group[0]=(0,1) Group[1]=(0,1)") - runRegexTrial(t, `(a+|b){0,1}`, IgnoreCase, "AB", "Pass. Group[0]=(0,1) Group[1]=(0,1)") - runRegexTrial(t, `(a+|b){0,1}?`, IgnoreCase, "AB", "Pass. Group[0]=(0,0) Group[1]=") - runRegexTrial(t, `)(`, IgnoreCase, "-", "Error.") - runRegexTrial(t, `[^ab]*`, IgnoreCase, "CDE", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `abc`, IgnoreCase, "", "Fail.") - runRegexTrial(t, `a*`, IgnoreCase, "", "Pass. Group[0]=(0,0)") - runRegexTrial(t, `([abc])*d`, IgnoreCase, "ABBBCD", "Pass. Group[0]=(0,6) Group[1]=(0,1)(1,1)(2,1)(3,1)(4,1)") - runRegexTrial(t, `([abc])*bcd`, IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(0,1)") - runRegexTrial(t, `a|b|c|d|e`, IgnoreCase, "E", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `(a|b|c|d|e)f`, IgnoreCase, "EF", "Pass. Group[0]=(0,2) Group[1]=(0,1)") - runRegexTrial(t, `abcd*efg`, IgnoreCase, "ABCDEFG", "Pass. Group[0]=(0,7)") - runRegexTrial(t, `ab*`, IgnoreCase, "XABYABBBZ", "Pass. Group[0]=(1,2)") - runRegexTrial(t, `ab*`, IgnoreCase, "XAYABBBZ", "Pass. Group[0]=(1,1)") - runRegexTrial(t, `(ab|cd)e`, IgnoreCase, "ABCDE", "Pass. Group[0]=(2,3) Group[1]=(2,2)") - runRegexTrial(t, `[abhgefdc]ij`, IgnoreCase, "HIJ", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `^(ab|cd)e`, IgnoreCase, "ABCDE", "Fail.") - runRegexTrial(t, `(abc|)ef`, IgnoreCase, "ABCDEF", "Pass. Group[0]=(4,2) Group[1]=(4,0)") - runRegexTrial(t, `(a|b)c*d`, IgnoreCase, "ABCD", "Pass. Group[0]=(1,3) Group[1]=(1,1)") - runRegexTrial(t, `(ab|ab*)bc`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(0,1)") - runRegexTrial(t, `a([bc]*)c*`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(1,2)") - runRegexTrial(t, `a([bc]*)(c*d)`, IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)") - runRegexTrial(t, `a([bc]+)(c*d)`, IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)") - runRegexTrial(t, `a([bc]*)(c+d)`, IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)") - runRegexTrial(t, `a[bcd]*dcdcde`, IgnoreCase, "ADCDCDE", "Pass. Group[0]=(0,7)") - runRegexTrial(t, `a[bcd]+dcdcde`, IgnoreCase, "ADCDCDE", "Fail.") - runRegexTrial(t, `(ab|a)b*c`, IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(0,2)") - runRegexTrial(t, `((a)(b)c)(d)`, IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]=(0,1) Group[3]=(1,1) Group[4]=(3,1)") - runRegexTrial(t, `[a-zA-Z_][a-zA-Z0-9_]*`, IgnoreCase, "ALPHA", "Pass. Group[0]=(0,5)") - runRegexTrial(t, `^a(bc+|b[eh])g|.h$`, IgnoreCase, "ABH", "Pass. Group[0]=(1,2) Group[1]=") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, "EFFGZ", "Pass. Group[0]=(0,5) Group[1]=(0,5) Group[2]=") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, "IJ", "Pass. Group[0]=(0,2) Group[1]=(0,2) Group[2]=(1,1)") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, "EFFG", "Fail.") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, "BCDD", "Fail.") - runRegexTrial(t, `(bc+d$|ef*g.|h?i(j|k))`, IgnoreCase, "REFFGZ", "Pass. Group[0]=(1,5) Group[1]=(1,5) Group[2]=") - runRegexTrial(t, `((((((((((a))))))))))`, IgnoreCase, "A", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)") - runRegexTrial(t, `((((((((((a))))))))))\10`, IgnoreCase, "AA", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)") - runRegexTrial(t, `((((((((((a))))))))))!`, IgnoreCase, "AA", "Fail.") - runRegexTrial(t, `((((((((((a))))))))))!`, IgnoreCase, "A!", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)") - runRegexTrial(t, `(((((((((a)))))))))`, IgnoreCase, "A", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1)") - runRegexTrial(t, `(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))`, IgnoreCase, "A", "Pass. Group[0]=(0,1) Group[1]=(0,1)") - runRegexTrial(t, `(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))`, IgnoreCase, "C", "Pass. Group[0]=(0,1) Group[1]=(0,1)") - runRegexTrial(t, `multiple words of text`, IgnoreCase, "UH-UH", "Fail.") - runRegexTrial(t, `multiple words`, IgnoreCase, "MULTIPLE WORDS, YEAH", "Pass. Group[0]=(0,14)") - runRegexTrial(t, `(.*)c(.*)`, IgnoreCase, "ABCDE", "Pass. Group[0]=(0,5) Group[1]=(0,2) Group[2]=(3,2)") - runRegexTrial(t, `\((.*), (.*)\)`, IgnoreCase, "(A, B)", "Pass. Group[0]=(0,6) Group[1]=(1,1) Group[2]=(4,1)") - runRegexTrial(t, `[k]`, IgnoreCase, "AB", "Fail.") - runRegexTrial(t, `abcd`, IgnoreCase, "ABCD", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `a(bc)d`, IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,2)") - runRegexTrial(t, `a[-]?c`, IgnoreCase, "AC", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `(abc)\1`, IgnoreCase, "ABCABC", "Pass. Group[0]=(0,6) Group[1]=(0,3)") - runRegexTrial(t, `([a-c]*)\1`, IgnoreCase, "ABCABC", "Pass. Group[0]=(0,6) Group[1]=(0,3)") - runRegexTrial(t, `a(?!b).`, 0, "abad", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `a(?=d).`, 0, "abad", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `a(?=c|d).`, 0, "abad", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `a(?:b|c|d)(.)`, 0, "ace", "Pass. Group[0]=(0,3) Group[1]=(2,1)") - runRegexTrial(t, `a(?:b|c|d)*(.)`, 0, "ace", "Pass. Group[0]=(0,3) Group[1]=(2,1)") - runRegexTrial(t, `a(?:b|c|d)+?(.)`, 0, "ace", "Pass. Group[0]=(0,3) Group[1]=(2,1)") - runRegexTrial(t, `a(?:b|c|d)+?(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,3) Group[1]=(2,1)") - runRegexTrial(t, `a(?:b|c|d)+(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)") - runRegexTrial(t, `a(?:b|c|d){2}(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,4) Group[1]=(3,1)") - runRegexTrial(t, `a(?:b|c|d){4,5}(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,7) Group[1]=(6,1)") - runRegexTrial(t, `a(?:b|c|d){4,5}?(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,6) Group[1]=(5,1)") - runRegexTrial(t, `((foo)|(bar))*`, 0, "foobar", "Pass. Group[0]=(0,6) Group[1]=(0,3)(3,3) Group[2]=(0,3) Group[3]=(3,3)") - runRegexTrial(t, `:(?:`, 0, "-", "Error.") - runRegexTrial(t, `a(?:b|c|d){6,7}(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)") - runRegexTrial(t, `a(?:b|c|d){6,7}?(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)") - runRegexTrial(t, `a(?:b|c|d){5,6}(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)") - runRegexTrial(t, `a(?:b|c|d){5,6}?(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,7) Group[1]=(6,1)") - runRegexTrial(t, `a(?:b|c|d){5,7}(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)") - runRegexTrial(t, `a(?:b|c|d){5,7}?(.)`, 0, "acdbcdbe", "Pass. Group[0]=(0,7) Group[1]=(6,1)") - runRegexTrial(t, `a(?:b|(c|e){1,2}?|d)+?(.)`, 0, "ace", "Pass. Group[0]=(0,3) Group[1]=(1,1) Group[2]=(2,1)") - runRegexTrial(t, `^(.+)?B`, 0, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)") - runRegexTrial(t, `^([^a-z])|(\^)$`, 0, ".", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=") - runRegexTrial(t, `^[<>]&`, 0, "<&OUT", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `^(a\1?){4}$`, 0, "aaaaaaaaaa", "Pass. Group[0]=(0,10) Group[1]=(0,1)(1,2)(3,3)(6,4)") - runRegexTrial(t, `^(a\1?){4}$`, 0, "aaaaaaaaa", "Fail.") - runRegexTrial(t, `^(a\1?){4}$`, 0, "aaaaaaaaaaa", "Fail.") - runRegexTrial(t, `^(a(?(1)\1)){4}$`, 0, "aaaaaaaaaa", "Pass. Group[0]=(0,10) Group[1]=(0,1)(1,2)(3,3)(6,4)") - runRegexTrial(t, `^(a(?(1)\1)){4}$`, 0, "aaaaaaaaa", "Fail.") - runRegexTrial(t, `^(a(?(1)\1)){4}$`, 0, "aaaaaaaaaaa", "Fail.") - runRegexTrial(t, `((a{4})+)`, 0, "aaaaaaaaa", "Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4)") - runRegexTrial(t, `(((aa){2})+)`, 0, "aaaaaaaaaa", "Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4) Group[3]=(0,2)(2,2)(4,2)(6,2)") - runRegexTrial(t, `(((a{2}){2})+)`, 0, "aaaaaaaaaa", "Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4) Group[3]=(0,2)(2,2)(4,2)(6,2)") - runRegexTrial(t, `(?:(f)(o)(o)|(b)(a)(r))*`, 0, "foobar", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(1,1) Group[3]=(2,1) Group[4]=(3,1) Group[5]=(4,1) Group[6]=(5,1)") - runRegexTrial(t, `(?<=a)b`, 0, "ab", "Pass. Group[0]=(1,1)") - runRegexTrial(t, `(?<=a)b`, 0, "cb", "Fail.") - runRegexTrial(t, `(?<=a)b`, 0, "b", "Fail.") - runRegexTrial(t, `(?a+)ab`, 0, "aaab", "Fail.") - runRegexTrial(t, `(?>a+)b`, 0, "aaab", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `([[:]+)`, 0, "a:[b]:", "Pass. Group[0]=(1,2) Group[1]=(1,2)") - runRegexTrial(t, `([[=]+)`, 0, "a=[b]=", "Pass. Group[0]=(1,2) Group[1]=(1,2)") - runRegexTrial(t, `([[.]+)`, 0, "a.[b].", "Pass. Group[0]=(1,2) Group[1]=(1,2)") - runRegexTrial(t, `[a[:]b[:c]`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `[a[:]b[:c]`, 0, "abc", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `((?>a+)b)`, 0, "aaab", "Pass. Group[0]=(0,4) Group[1]=(0,4)") - runRegexTrial(t, `(?>(a+))b`, 0, "aaab", "Pass. Group[0]=(0,4) Group[1]=(0,3)") - runRegexTrial(t, `((?>[^()]+)|\([^()]*\))+`, 0, "((abc(ade)ufh()()x", "Pass. Group[0]=(2,16) Group[1]=(2,3)(5,5)(10,3)(13,2)(15,2)(17,1)") - runRegexTrial(t, `(?<=x+)`, 0, "xxxxy", "Pass. Group[0]=(1,0)") - runRegexTrial(t, `a{37,17}`, 0, "-", "Error.") - runRegexTrial(t, `\Z`, 0, "a\nb\n", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `\z`, 0, "a\nb\n", "Pass. Group[0]=(4,0)") - runRegexTrial(t, `$`, 0, "a\nb\n", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `\Z`, 0, "b\na\n", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `\z`, 0, "b\na\n", "Pass. Group[0]=(4,0)") - runRegexTrial(t, `$`, 0, "b\na\n", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `\Z`, 0, "b\na", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `\z`, 0, "b\na", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `$`, 0, "b\na", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `\Z`, Multiline, "a\nb\n", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `\z`, Multiline, "a\nb\n", "Pass. Group[0]=(4,0)") - runRegexTrial(t, `$`, Multiline, "a\nb\n", "Pass. Group[0]=(1,0)") - runRegexTrial(t, `\Z`, Multiline, "b\na\n", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `\z`, Multiline, "b\na\n", "Pass. Group[0]=(4,0)") - runRegexTrial(t, `$`, Multiline, "b\na\n", "Pass. Group[0]=(1,0)") - runRegexTrial(t, `\Z`, Multiline, "b\na", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `\z`, Multiline, "b\na", "Pass. Group[0]=(3,0)") - runRegexTrial(t, `$`, Multiline, "b\na", "Pass. Group[0]=(1,0)") - runRegexTrial(t, `a\Z`, 0, "a\nb\n", "Fail.") - runRegexTrial(t, `a\z`, 0, "a\nb\n", "Fail.") - runRegexTrial(t, `a$`, 0, "a\nb\n", "Fail.") - runRegexTrial(t, `a\Z`, 0, "b\na\n", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `a\z`, 0, "b\na\n", "Fail.") - runRegexTrial(t, `a$`, 0, "b\na\n", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `a\Z`, 0, "b\na", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `a\z`, 0, "b\na", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `a$`, 0, "b\na", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `a\z`, Multiline, "a\nb\n", "Fail.") - runRegexTrial(t, `a$`, Multiline, "a\nb\n", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `a\Z`, Multiline, "b\na\n", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `a\z`, Multiline, "b\na\n", "Fail.") - runRegexTrial(t, `a$`, Multiline, "b\na\n", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `a\Z`, Multiline, "b\na", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `a\z`, Multiline, "b\na", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `a$`, Multiline, "b\na", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `aa\Z`, 0, "aa\nb\n", "Fail.") - runRegexTrial(t, `aa\z`, 0, "aa\nb\n", "Fail.") - runRegexTrial(t, `aa$`, 0, "aa\nb\n", "Fail.") - runRegexTrial(t, `aa\Z`, 0, "b\naa\n", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa\z`, 0, "b\naa\n", "Fail.") - runRegexTrial(t, `aa$`, 0, "b\naa\n", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa\Z`, 0, "b\naa", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa\z`, 0, "b\naa", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa$`, 0, "b\naa", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa\z`, Multiline, "aa\nb\n", "Fail.") - runRegexTrial(t, `aa$`, Multiline, "aa\nb\n", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `aa\Z`, Multiline, "b\naa\n", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa\z`, Multiline, "b\naa\n", "Fail.") - runRegexTrial(t, `aa$`, Multiline, "b\naa\n", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa\Z`, Multiline, "b\naa", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa\z`, Multiline, "b\naa", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa$`, Multiline, "b\naa", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `aa\Z`, 0, "ac\nb\n", "Fail.") - runRegexTrial(t, `aa\z`, 0, "ac\nb\n", "Fail.") - runRegexTrial(t, `aa$`, 0, "ac\nb\n", "Fail.") - runRegexTrial(t, `aa\Z`, 0, "b\nac\n", "Fail.") - runRegexTrial(t, `aa\z`, 0, "b\nac\n", "Fail.") - runRegexTrial(t, `aa$`, 0, "b\nac\n", "Fail.") - runRegexTrial(t, `aa\Z`, 0, "b\nac", "Fail.") - runRegexTrial(t, `aa\z`, 0, "b\nac", "Fail.") - runRegexTrial(t, `aa$`, 0, "b\nac", "Fail.") - runRegexTrial(t, `aa\Z`, Multiline, "ac\nb\n", "Fail.") - runRegexTrial(t, `aa\z`, Multiline, "ac\nb\n", "Fail.") - runRegexTrial(t, `aa$`, Multiline, "ac\nb\n", "Fail.") - runRegexTrial(t, `aa\Z`, Multiline, "b\nac\n", "Fail.") - runRegexTrial(t, `aa\z`, Multiline, "b\nac\n", "Fail.") - runRegexTrial(t, `aa$`, Multiline, "b\nac\n", "Fail.") - runRegexTrial(t, `aa\Z`, Multiline, "b\nac", "Fail.") - runRegexTrial(t, `aa\z`, Multiline, "b\nac", "Fail.") - runRegexTrial(t, `aa$`, Multiline, "b\nac", "Fail.") - runRegexTrial(t, `aa\Z`, 0, "ca\nb\n", "Fail.") - runRegexTrial(t, `aa\z`, 0, "ca\nb\n", "Fail.") - runRegexTrial(t, `aa$`, 0, "ca\nb\n", "Fail.") - runRegexTrial(t, `aa\Z`, 0, "b\nca\n", "Fail.") - runRegexTrial(t, `aa\z`, 0, "b\nca\n", "Fail.") - runRegexTrial(t, `aa$`, 0, "b\nca\n", "Fail.") - runRegexTrial(t, `aa\Z`, 0, "b\nca", "Fail.") - runRegexTrial(t, `aa\z`, 0, "b\nca", "Fail.") - runRegexTrial(t, `aa$`, 0, "b\nca", "Fail.") - runRegexTrial(t, `aa\Z`, Multiline, "ca\nb\n", "Fail.") - runRegexTrial(t, `aa\z`, Multiline, "ca\nb\n", "Fail.") - runRegexTrial(t, `aa$`, Multiline, "ca\nb\n", "Fail.") - runRegexTrial(t, `aa\Z`, Multiline, "b\nca\n", "Fail.") - runRegexTrial(t, `aa\z`, Multiline, "b\nca\n", "Fail.") - runRegexTrial(t, `aa$`, Multiline, "b\nca\n", "Fail.") - runRegexTrial(t, `aa\Z`, Multiline, "b\nca", "Fail.") - runRegexTrial(t, `aa\z`, Multiline, "b\nca", "Fail.") - runRegexTrial(t, `aa$`, Multiline, "b\nca", "Fail.") - runRegexTrial(t, `ab\Z`, 0, "ab\nb\n", "Fail.") - runRegexTrial(t, `ab\z`, 0, "ab\nb\n", "Fail.") - runRegexTrial(t, `ab$`, 0, "ab\nb\n", "Fail.") - runRegexTrial(t, `ab\Z`, 0, "b\nab\n", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab\z`, 0, "b\nab\n", "Fail.") - runRegexTrial(t, `ab$`, 0, "b\nab\n", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab\Z`, 0, "b\nab", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab\z`, 0, "b\nab", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab$`, 0, "b\nab", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab\z`, Multiline, "ab\nb\n", "Fail.") - runRegexTrial(t, `ab$`, Multiline, "ab\nb\n", "Pass. Group[0]=(0,2)") - runRegexTrial(t, `ab\Z`, Multiline, "b\nab\n", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab\z`, Multiline, "b\nab\n", "Fail.") - runRegexTrial(t, `ab$`, Multiline, "b\nab\n", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab\Z`, Multiline, "b\nab", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab\z`, Multiline, "b\nab", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab$`, Multiline, "b\nab", "Pass. Group[0]=(2,2)") - runRegexTrial(t, `ab\Z`, 0, "ac\nb\n", "Fail.") - runRegexTrial(t, `ab\z`, 0, "ac\nb\n", "Fail.") - runRegexTrial(t, `ab$`, 0, "ac\nb\n", "Fail.") - runRegexTrial(t, `ab\Z`, 0, "b\nac\n", "Fail.") - runRegexTrial(t, `ab\z`, 0, "b\nac\n", "Fail.") - runRegexTrial(t, `ab$`, 0, "b\nac\n", "Fail.") - runRegexTrial(t, `ab\Z`, 0, "b\nac", "Fail.") - runRegexTrial(t, `ab\z`, 0, "b\nac", "Fail.") - runRegexTrial(t, `ab$`, 0, "b\nac", "Fail.") - runRegexTrial(t, `ab\Z`, Multiline, "ac\nb\n", "Fail.") - runRegexTrial(t, `ab\z`, Multiline, "ac\nb\n", "Fail.") - runRegexTrial(t, `ab$`, Multiline, "ac\nb\n", "Fail.") - runRegexTrial(t, `ab\Z`, Multiline, "b\nac\n", "Fail.") - runRegexTrial(t, `ab\z`, Multiline, "b\nac\n", "Fail.") - runRegexTrial(t, `ab$`, Multiline, "b\nac\n", "Fail.") - runRegexTrial(t, `ab\Z`, Multiline, "b\nac", "Fail.") - runRegexTrial(t, `ab\z`, Multiline, "b\nac", "Fail.") - runRegexTrial(t, `ab$`, Multiline, "b\nac", "Fail.") - runRegexTrial(t, `ab\Z`, 0, "ca\nb\n", "Fail.") - runRegexTrial(t, `ab\z`, 0, "ca\nb\n", "Fail.") - runRegexTrial(t, `ab$`, 0, "ca\nb\n", "Fail.") - runRegexTrial(t, `ab\Z`, 0, "b\nca\n", "Fail.") - runRegexTrial(t, `ab\z`, 0, "b\nca\n", "Fail.") - runRegexTrial(t, `ab$`, 0, "b\nca\n", "Fail.") - runRegexTrial(t, `ab\Z`, 0, "b\nca", "Fail.") - runRegexTrial(t, `ab\z`, 0, "b\nca", "Fail.") - runRegexTrial(t, `ab$`, 0, "b\nca", "Fail.") - runRegexTrial(t, `ab\Z`, Multiline, "ca\nb\n", "Fail.") - runRegexTrial(t, `ab\z`, Multiline, "ca\nb\n", "Fail.") - runRegexTrial(t, `ab$`, Multiline, "ca\nb\n", "Fail.") - runRegexTrial(t, `ab\Z`, Multiline, "b\nca\n", "Fail.") - runRegexTrial(t, `ab\z`, Multiline, "b\nca\n", "Fail.") - runRegexTrial(t, `ab$`, Multiline, "b\nca\n", "Fail.") - runRegexTrial(t, `ab\Z`, Multiline, "b\nca", "Fail.") - runRegexTrial(t, `ab\z`, Multiline, "b\nca", "Fail.") - runRegexTrial(t, `ab$`, Multiline, "b\nca", "Fail.") - runRegexTrial(t, `abb\Z`, 0, "abb\nb\n", "Fail.") - runRegexTrial(t, `abb\z`, 0, "abb\nb\n", "Fail.") - runRegexTrial(t, `abb$`, 0, "abb\nb\n", "Fail.") - runRegexTrial(t, `abb\Z`, 0, "b\nabb\n", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb\z`, 0, "b\nabb\n", "Fail.") - runRegexTrial(t, `abb$`, 0, "b\nabb\n", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb\Z`, 0, "b\nabb", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb\z`, 0, "b\nabb", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb$`, 0, "b\nabb", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb\z`, Multiline, "abb\nb\n", "Fail.") - runRegexTrial(t, `abb$`, Multiline, "abb\nb\n", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `abb\Z`, Multiline, "b\nabb\n", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb\z`, Multiline, "b\nabb\n", "Fail.") - runRegexTrial(t, `abb$`, Multiline, "b\nabb\n", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb\Z`, Multiline, "b\nabb", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb\z`, Multiline, "b\nabb", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb$`, Multiline, "b\nabb", "Pass. Group[0]=(2,3)") - runRegexTrial(t, `abb\Z`, 0, "ac\nb\n", "Fail.") - runRegexTrial(t, `abb\z`, 0, "ac\nb\n", "Fail.") - runRegexTrial(t, `abb$`, 0, "ac\nb\n", "Fail.") - runRegexTrial(t, `abb\Z`, 0, "b\nac\n", "Fail.") - runRegexTrial(t, `abb\z`, 0, "b\nac\n", "Fail.") - runRegexTrial(t, `abb$`, 0, "b\nac\n", "Fail.") - runRegexTrial(t, `abb\Z`, 0, "b\nac", "Fail.") - runRegexTrial(t, `abb\z`, 0, "b\nac", "Fail.") - runRegexTrial(t, `abb$`, 0, "b\nac", "Fail.") - runRegexTrial(t, `abb\Z`, Multiline, "ac\nb\n", "Fail.") - runRegexTrial(t, `abb\z`, Multiline, "ac\nb\n", "Fail.") - runRegexTrial(t, `abb$`, Multiline, "ac\nb\n", "Fail.") - runRegexTrial(t, `abb\Z`, Multiline, "b\nac\n", "Fail.") - runRegexTrial(t, `abb\z`, Multiline, "b\nac\n", "Fail.") - runRegexTrial(t, `abb$`, Multiline, "b\nac\n", "Fail.") - runRegexTrial(t, `abb\Z`, Multiline, "b\nac", "Fail.") - runRegexTrial(t, `abb\z`, Multiline, "b\nac", "Fail.") - runRegexTrial(t, `abb$`, Multiline, "b\nac", "Fail.") - runRegexTrial(t, `abb\Z`, 0, "ca\nb\n", "Fail.") - runRegexTrial(t, `abb\z`, 0, "ca\nb\n", "Fail.") - runRegexTrial(t, `abb$`, 0, "ca\nb\n", "Fail.") - runRegexTrial(t, `abb\Z`, 0, "b\nca\n", "Fail.") - runRegexTrial(t, `abb\z`, 0, "b\nca\n", "Fail.") - runRegexTrial(t, `abb$`, 0, "b\nca\n", "Fail.") - runRegexTrial(t, `abb\Z`, 0, "b\nca", "Fail.") - runRegexTrial(t, `abb\z`, 0, "b\nca", "Fail.") - runRegexTrial(t, `abb$`, 0, "b\nca", "Fail.") - runRegexTrial(t, `abb\Z`, Multiline, "ca\nb\n", "Fail.") - runRegexTrial(t, `abb\z`, Multiline, "ca\nb\n", "Fail.") - runRegexTrial(t, `abb$`, Multiline, "ca\nb\n", "Fail.") - runRegexTrial(t, `abb\Z`, Multiline, "b\nca\n", "Fail.") - runRegexTrial(t, `abb\z`, Multiline, "b\nca\n", "Fail.") - runRegexTrial(t, `abb$`, Multiline, "b\nca\n", "Fail.") - runRegexTrial(t, `abb\Z`, Multiline, "b\nca", "Fail.") - runRegexTrial(t, `abb\z`, Multiline, "b\nca", "Fail.") - runRegexTrial(t, `abb$`, Multiline, "b\nca", "Fail.") - runRegexTrial(t, `(^|x)(c)`, 0, "ca", "Pass. Group[0]=(0,1) Group[1]=(0,0) Group[2]=(0,1)") - runRegexTrial(t, `a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz`, 0, "x", "Fail.") - runRegexTrial(t, `round\(((?>[^()]+))\)`, 0, "_I(round(xs * sz),1)", "Pass. Group[0]=(3,14) Group[1]=(9,7)") - runRegexTrial(t, `foo.bart`, 0, "foo.bart", "Pass. Group[0]=(0,8)") - runRegexTrial(t, `^d[x][x][x]`, Multiline, "abcd\ndxxx", "Pass. Group[0]=(5,4)") - runRegexTrial(t, `.X(.+)+X`, 0, "bbbbXcXaaaaaaaa", "Pass. Group[0]=(3,4) Group[1]=(5,1)") - runRegexTrial(t, `.X(.+)+XX`, 0, "bbbbXcXXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(5,1)") - runRegexTrial(t, `.XX(.+)+X`, 0, "bbbbXXcXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(6,1)") - runRegexTrial(t, `.X(.+)+X`, 0, "bbbbXXaaaaaaaaa", "Fail.") - runRegexTrial(t, `.X(.+)+XX`, 0, "bbbbXXXaaaaaaaaa", "Fail.") - runRegexTrial(t, `.XX(.+)+X`, 0, "bbbbXXXaaaaaaaaa", "Fail.") - runRegexTrial(t, `.X(.+)+[X]`, 0, "bbbbXcXaaaaaaaa", "Pass. Group[0]=(3,4) Group[1]=(5,1)") - runRegexTrial(t, `.X(.+)+[X][X]`, 0, "bbbbXcXXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(5,1)") - runRegexTrial(t, `.XX(.+)+[X]`, 0, "bbbbXXcXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(6,1)") - runRegexTrial(t, `.X(.+)+[X]`, 0, "bbbbXXaaaaaaaaa", "Fail.") - runRegexTrial(t, `.X(.+)+[X][X]`, 0, "bbbbXXXaaaaaaaaa", "Fail.") - runRegexTrial(t, `.XX(.+)+[X]`, 0, "bbbbXXXaaaaaaaaa", "Fail.") - runRegexTrial(t, `.[X](.+)+[X]`, 0, "bbbbXcXaaaaaaaa", "Pass. Group[0]=(3,4) Group[1]=(5,1)") - runRegexTrial(t, `.[X](.+)+[X][X]`, 0, "bbbbXcXXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(5,1)") - runRegexTrial(t, `.[X][X](.+)+[X]`, 0, "bbbbXXcXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(6,1)") - runRegexTrial(t, `.[X](.+)+[X]`, 0, "bbbbXXaaaaaaaaa", "Fail.") - runRegexTrial(t, `.[X](.+)+[X][X]`, 0, "bbbbXXXaaaaaaaaa", "Fail.") - runRegexTrial(t, `.[X][X](.+)+[X]`, 0, "bbbbXXXaaaaaaaaa", "Fail.") - runRegexTrial(t, `tt+$`, 0, "xxxtt", "Pass. Group[0]=(3,2)") - runRegexTrial(t, `([\d-z]+)`, 0, "a0-za", "Pass. Group[0]=(1,3) Group[1]=(1,3)") - runRegexTrial(t, `([\d-\s]+)`, 0, "a0- z", "Pass. Group[0]=(1,3) Group[1]=(1,3)") - runRegexTrial(t, `\GX.*X`, 0, "aaaXbX", "Fail.") - runRegexTrial(t, `(\d+\.\d+)`, 0, "3.1415926", "Pass. Group[0]=(0,9) Group[1]=(0,9)") - runRegexTrial(t, `(\ba.{0,10}br)`, 0, "have a web browser", "Pass. Group[0]=(5,8) Group[1]=(5,8)") - runRegexTrial(t, `\.c(pp|xx|c)?$`, IgnoreCase, "Changes", "Fail.") - runRegexTrial(t, `\.c(pp|xx|c)?$`, IgnoreCase, "IO.c", "Pass. Group[0]=(2,2) Group[1]=") - runRegexTrial(t, `(\.c(pp|xx|c)?$)`, IgnoreCase, "IO.c", "Pass. Group[0]=(2,2) Group[1]=(2,2) Group[2]=") - runRegexTrial(t, `^([a-z]:)`, 0, "C:/", "Fail.") - runRegexTrial(t, `^\S\s+aa$`, Multiline, "\nx aa", "Pass. Group[0]=(1,4)") - runRegexTrial(t, `(^|a)b`, 0, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)") - runRegexTrial(t, `^([ab]*?)(b)?(c)$`, 0, "abac", "Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]= Group[3]=(3,1)") - runRegexTrial(t, `(\w)?(abc)\1b`, 0, "abcab", "Fail.") - runRegexTrial(t, `^(?:.,){2}c`, 0, "a,b,c", "Pass. Group[0]=(0,5)") - runRegexTrial(t, `^(.,){2}c`, 0, "a,b,c", "Pass. Group[0]=(0,5) Group[1]=(0,2)(2,2)") - runRegexTrial(t, `^(?:[^,]*,){2}c`, 0, "a,b,c", "Pass. Group[0]=(0,5)") - runRegexTrial(t, `^([^,]*,){2}c`, 0, "a,b,c", "Pass. Group[0]=(0,5) Group[1]=(0,2)(2,2)") - runRegexTrial(t, `^([^,]*,){3}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]*,){3,}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]*,){0,3}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]{1,3},){3}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]{1,3},){3,}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]{1,3},){0,3}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]{1,},){3}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]{1,},){3,}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]{1,},){0,3}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]{0,3},){3}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]{0,3},){3,}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `^([^,]{0,3},){0,3}d`, 0, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)") - runRegexTrial(t, `(?i)`, 0, "", "Pass. Group[0]=(0,0)") - runRegexTrial(t, `(?!\A)x`, Multiline, "a\nxb\n", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `^(a(b)?)+$`, 0, "aba", "Pass. Group[0]=(0,3) Group[1]=(0,2)(2,1) Group[2]=(1,1)") - runRegexTrial(t, `^(aa(bb)?)+$`, 0, "aabbaa", "Pass. Group[0]=(0,6) Group[1]=(0,4)(4,2) Group[2]=(2,2)") - runRegexTrial(t, `^.{9}abc.*\n`, Multiline, "123\nabcabcabcabc\n", "Pass. Group[0]=(4,13)") - runRegexTrial(t, `^(a)?a$`, 0, "a", "Pass. Group[0]=(0,1) Group[1]=") - runRegexTrial(t, `^(a)?(?(1)a|b)+$`, 0, "a", "Fail.") - runRegexTrial(t, `^(a\1?)(a\1?)(a\2?)(a\3?)$`, 0, "aaaaaa", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(1,2) Group[3]=(3,1) Group[4]=(4,2)") - runRegexTrial(t, `^(a\1?){4}$`, 0, "aaaaaa", "Pass. Group[0]=(0,6) Group[1]=(0,1)(1,2)(3,1)(4,2)") - runRegexTrial(t, `^(0+)?(?:x(1))?`, 0, "x1", "Pass. Group[0]=(0,2) Group[1]= Group[2]=(1,1)") - runRegexTrial(t, `^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?`, 0, "012cxx0190", "Pass. Group[0]=(0,10) Group[1]=(0,4) Group[2]= Group[3]=(6,4)") - runRegexTrial(t, `^(b+?|a){1,2}c`, 0, "bbbac", "Pass. Group[0]=(0,5) Group[1]=(0,3)(3,1)") - runRegexTrial(t, `^(b+?|a){1,2}c`, 0, "bbbbac", "Pass. Group[0]=(0,6) Group[1]=(0,4)(4,1)") - runRegexTrial(t, `\((\w\. \w+)\)`, 0, "cd. (A. Tw)", "Pass. Group[0]=(4,7) Group[1]=(5,5)") - runRegexTrial(t, `((?:aaaa|bbbb)cccc)?`, 0, "aaaacccc", "Pass. Group[0]=(0,8) Group[1]=(0,8)") - runRegexTrial(t, `((?:aaaa|bbbb)cccc)?`, 0, "bbbbcccc", "Pass. Group[0]=(0,8) Group[1]=(0,8)") - - runRegexTrial(t, `^(foo)|(bar)$`, 0, "foobar", "Pass. Group[0]=(0,3) Group[1]=(0,3) Group[2]=") - runRegexTrial(t, `^(foo)|(bar)$`, RightToLeft, "foobar", "Pass. Group[0]=(3,3) Group[1]= Group[2]=(3,3)") - - runRegexTrial(t, `b`, RightToLeft, "babaaa", "Pass. Group[0]=(2,1)") - runRegexTrial(t, `bab`, RightToLeft, "babababaa", "Pass. Group[0]=(4,3)") - runRegexTrial(t, `abb`, RightToLeft, "abb", "Pass. Group[0]=(0,3)") - - runRegexTrial(t, `b$`, RightToLeft|Multiline, "aab\naab", "Pass. Group[0]=(6,1)") - runRegexTrial(t, `^a`, RightToLeft|Multiline, "aab\naab", "Pass. Group[0]=(4,1)") - runRegexTrial(t, `^aaab`, RightToLeft|Multiline, "aaab\naab", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `abb{2}`, RightToLeft, "abbb", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `abb{1,2}`, RightToLeft, "abbb", "Pass. Group[0]=(0,4)") - - runRegexTrial(t, `abb{1,2}`, RightToLeft, "abbbbbaaaa", "Pass. Group[0]=(0,4)") - runRegexTrial(t, `\Ab`, RightToLeft, "bab\naaa", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `\Abab$`, RightToLeft, "bab", "Pass. Group[0]=(0,3)") - runRegexTrial(t, `b\Z`, RightToLeft, "bab\naaa", "Fail.") - runRegexTrial(t, `b\Z`, RightToLeft, "babaaab", "Pass. Group[0]=(6,1)") - runRegexTrial(t, `b\z`, RightToLeft, "babaaa", "Fail.") - runRegexTrial(t, `b\z`, RightToLeft, "babaaab", "Pass. Group[0]=(6,1)") - runRegexTrial(t, `a\G`, RightToLeft, "babaaa", "Pass. Group[0]=(5,1)") - runRegexTrial(t, `\Abaaa\G`, RightToLeft, "baaa", "Pass. Group[0]=(0,4)") - // runRegexTrial(t, `b`, RightToLeft, "babaaa", "Pass. Group[0]=(2,1)") - // runRegexTrial(t, `b`, RightToLeft, "babaaa", "Pass. Group[0]=(2,1)") - // runRegexTrial(t, `b`, RightToLeft, "babaaa", "Pass. Group[0]=(2,1)") - // runRegexTrial(t, `b`, RightToLeft, "babaaa", "Pass. Group[0]=(2,1)") - - runRegexTrial(t, `\bc`, RightToLeft, "aaa c aaa c a", "Pass. Group[0]=(10,1)") - runRegexTrial(t, `\bc`, RightToLeft, "c aaa c", "Pass. Group[0]=(6,1)") - runRegexTrial(t, `\bc`, RightToLeft, "aaa ac", "Fail.") - runRegexTrial(t, `\bc`, RightToLeft, "c aaa", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `\bc`, RightToLeft, "aaacaaa", "Fail.") - runRegexTrial(t, `\bc`, RightToLeft, "aaac aaa", "Fail.") - runRegexTrial(t, `\bc`, RightToLeft, "aaa ca caaa", "Pass. Group[0]=(7,1)") - - runRegexTrial(t, `\Bc`, RightToLeft, "ac aaa ac", "Pass. Group[0]=(8,1)") - runRegexTrial(t, `\Bc`, RightToLeft, "aaa c", "Fail.") - runRegexTrial(t, `\Bc`, RightToLeft, "ca aaa", "Fail.") - runRegexTrial(t, `\Bc`, RightToLeft, "aaa c aaa", "Fail.") - runRegexTrial(t, `\Bc`, RightToLeft, " acaca ", "Pass. Group[0]=(4,1)") - runRegexTrial(t, `\Bc`, RightToLeft, "aaac aaac", "Pass. Group[0]=(8,1)") - runRegexTrial(t, `\Bc`, RightToLeft, "aaa caaa", "Fail.") - - runRegexTrial(t, `b(a?)b`, RightToLeft, "aabababbaaababa", "Pass. Group[0]=(11,3) Group[1]=(12,1)") - runRegexTrial(t, `b{4}`, RightToLeft, "abbbbaabbbbaabbb", "Pass. Group[0]=(7,4)") - runRegexTrial(t, `b\1aa(.)`, RightToLeft, "bBaaB", "Pass. Group[0]=(0,5) Group[1]=(4,1)") - runRegexTrial(t, `b(.)aa\1`, RightToLeft, "bBaaB", "Fail.") - - runRegexTrial(t, `^(a\1?){4}$`, RightToLeft, "aaaaaa", "Pass. Group[0]=(0,6) Group[1]=(5,1)(3,2)(2,1)(0,2)") - runRegexTrial(t, `^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?`, RightToLeft, "012cxx0190", "Pass. Group[0]=(0,10) Group[1]=(0,4) Group[2]= Group[3]=(6,4)") - runRegexTrial(t, `^(b+?|a){1,2}c`, RightToLeft, "bbbac", "Pass. Group[0]=(0,5) Group[1]=(3,1)(0,3)") - runRegexTrial(t, `\((\w\. \w+)\)`, RightToLeft, "cd. (A. Tw)", "Pass. Group[0]=(4,7) Group[1]=(5,5)") - runRegexTrial(t, `((?:aaaa|bbbb)cccc)?`, RightToLeft, "aaaacccc", "Pass. Group[0]=(0,8) Group[1]=(0,8)") - runRegexTrial(t, `((?:aaaa|bbbb)cccc)?`, RightToLeft, "bbbbcccc", "Pass. Group[0]=(0,8) Group[1]=(0,8)") - - runRegexTrial(t, `(?<=a)b`, RightToLeft, "ab", "Pass. Group[0]=(1,1)") - runRegexTrial(t, `(?<=a)b`, RightToLeft, "cb", "Fail.") - runRegexTrial(t, `(?<=a)b`, RightToLeft, "b", "Fail.") - runRegexTrial(t, `(?[^()]+|\((?)|\)(?<-depth>))*(?(depth)(?!))\)`, 0, "((a(b))c)", "Pass. Group[0]=(0,9) Group[1]=") - runRegexTrial(t, `^\((?>[^()]+|\((?)|\)(?<-depth>))*(?(depth)(?!))\)$`, 0, "((a(b))c)", "Pass. Group[0]=(0,9) Group[1]=") - runRegexTrial(t, `^\((?>[^()]+|\((?)|\)(?<-depth>))*(?(depth)(?!))\)$`, 0, "((a(b))c", "Fail.") - - runRegexTrial(t, `^\((?>[^()]+|\((?)|\)(?<-depth>))*(?(depth)(?!))\)$`, 0, "())", "Fail.") - - runRegexTrial(t, `(((?\()[^()]*)+((?\))[^()]*)+)+(?(foo)(?!))`, 0, "((a(b))c)", - "Pass. Group[0]=(0,9) Group[1]=(0,9) Group[2]=(0,1)(1,2)(3,2) Group[3]=(5,1)(6,2)(8,1) Group[4]= Group[5]=(4,1)(2,4)(1,7)") - runRegexTrial(t, `^(((?\()[^()]*)+((?\))[^()]*)+)+(?(foo)(?!))$`, 0, "((a(b))c)", - "Pass. Group[0]=(0,9) Group[1]=(0,9) Group[2]=(0,1)(1,2)(3,2) Group[3]=(5,1)(6,2)(8,1) Group[4]= Group[5]=(4,1)(2,4)(1,7)") - runRegexTrial(t, `(((?\()[^()]*)+((?\))[^()]*)+)+(?(foo)(?!))`, 0, "x(a((b)))b)x", - "Pass. Group[0]=(1,9) Group[1]=(1,9) Group[2]=(1,2)(3,1)(4,2) Group[3]=(6,1)(7,1)(8,2) Group[4]= Group[5]=(5,1)(4,3)(2,6)") - runRegexTrial(t, `(((?\()[^()]*)+((?\))[^()]*)+)+(?(foo)(?!))`, 0, "x((a((b)))x", - "Pass. Group[0]=(2,9) Group[1]=(2,9) Group[2]=(2,2)(4,1)(5,2) Group[3]=(7,1)(8,1)(9,2) Group[4]= Group[5]=(6,1)(5,3)(3,6)") - runRegexTrial(t, `^(((?\()[^()]*)+((?\))[^()]*)+)+(?(foo)(?!))$`, 0, "((a(b))c", "Fail.") - runRegexTrial(t, `^(((?\()[^()]*)+((?\))[^()]*)+)+(?(foo)(?!))$`, 0, "((a(b))c))", "Fail.") - runRegexTrial(t, `^(((?\()[^()]*)+((?\))[^()]*)+)+(?(foo)(?!))$`, 0, ")(", "Fail.") - runRegexTrial(t, `^(((?\()[^()]*)+((?\))[^()]*)+)+(?(foo)(?!))$`, 0, "((a((b))c)", "Fail.") - - runRegexTrial(t, `b`, RightToLeft, "babaaa", "Pass. Group[0]=(2,1)") - - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "[n]", "Pass. Group[0]=(0,3) Group[1]=(1,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "n", "Pass. Group[0]=(0,1) Group[1]=(0,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "n[i]e", "Fail.") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "[n", "Fail.") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "]n]", "Fail.") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, `\[n\]`, "Fail.") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, `[n\]`, "Pass. Group[0]=(0,4) Group[1]=(1,2)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, `[n\[]`, "Pass. Group[0]=(0,5) Group[1]=(1,3)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, `[[n]`, "Pass. Group[0]=(0,4) Group[1]=(1,2)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "[s] . [n]", "Pass. Group[0]=(0,9) Group[1]=(1,1) Group[2]=(7,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "[s] . n", "Pass. Group[0]=(0,7) Group[1]=(1,1) Group[2]=(6,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "s.[ n ]", "Pass. Group[0]=(0,7) Group[1]=(0,1) Group[2]=(3,3)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, " . n", "Pass. Group[0]=(0,4) Group[1]=(0,1) Group[2]=(3,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "s. ", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "[.]. ", "Pass. Group[0]=(0,5) Group[1]=(1,1) Group[2]=(4,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "[c].[s].[n]", "Pass. Group[0]=(0,11) Group[1]=(1,1) Group[2]=(5,1) Group[3]=(9,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, " c . s . n ", "Pass. Group[0]=(0,11) Group[1]=(0,3) Group[2]=(5,2) Group[3]=(9,2)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, " . [.] . [ ]", "Pass. Group[0]=(0,12) Group[1]=(0,1) Group[2]=(4,1) Group[3]=(10,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "c.n", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "[c] .[n]", "Pass. Group[0]=(0,8) Group[1]=(1,1) Group[2]=(6,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "c.n.", "Fail.") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "s.c.n", "Pass. Group[0]=(0,5) Group[1]=(0,1) Group[2]=(2,1) Group[3]=(4,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "[s].[c].[n]", "Pass. Group[0]=(0,11) Group[1]=(1,1) Group[2]=(5,1) Group[3]=(9,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))\s*\.\s*((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, Compiled|IgnoreCase|ExplicitCapture, "[s].[c].", "Fail.") - runRegexTrial(t, `^((\[(?.+)\])|(?\S+))([ ]+(?ASC|DESC))?$`, IgnoreCase|ExplicitCapture, "[id]]", "Pass. Group[0]=(0,5) Group[1]=(1,3) Group[2]=") - runRegexTrial(t, `a{1,2147483647}`, 0, "a", "Pass. Group[0]=(0,1)") - runRegexTrial(t, `^((\[(?[^\]]+)\])|(?[^\.\[\]]+))$`, 0, "[a]", "Pass. Group[0]=(0,3) Group[1]=(0,3) Group[2]=(0,3) Group[3]=(1,1)") - -} - -func runRegexTrial(t *testing.T, pattern string, options RegexOptions, input, expected string) { - result := "" - - re, err := Compile(pattern, options) - if err != nil { - if expected != "Error." { - t.Errorf("Compiling pattern '%v' with options '%v' -- expected '%v' got '%v'", pattern, options, expected, err.Error()) - } - return - } - - groupNums := re.GetGroupNumbers() - m, err := re.FindStringMatch(input) - if err != nil { - result = fmt.Sprintf("Error. %v", err.Error()) - } else if m != nil { - result = "Pass." - for i, group := range m.Groups() { - gid := groupNums[i] - - result += fmt.Sprintf(" Group[%v]=", gid) - for _, cp := range group.Captures { - result += fmt.Sprintf("(%v,%v)", cp.Index, cp.Length) - } - } - } else { - result = "Fail." - } - - if expected != result { - t.Errorf("Matching input '%v' against pattern '%v' with options '%v' -- expected '%v' got '%v'", input, pattern, options, expected, result) - } -} diff --git a/vendor/github.com/dlclark/regexp2/regexp_options_test.go b/vendor/github.com/dlclark/regexp2/regexp_options_test.go deleted file mode 100644 index 591cdbc..0000000 --- a/vendor/github.com/dlclark/regexp2/regexp_options_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package regexp2 - -import "testing" - -func TestIgnoreCase_Simple(t *testing.T) { - r := MustCompile("aaamatch thisbbb", IgnoreCase) - m, err := r.FindStringMatch("AaAMatch thisBBb") - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - if m == nil { - t.Fatalf("no match when one was expected") - } - if want, got := "AaAMatch thisBBb", m.String(); want != got { - t.Fatalf("group 0 wanted '%v', got '%v'", want, got) - } -} - -func TestIgnoreCase_Inline(t *testing.T) { - r := MustCompile("aaa(?i:match this)bbb", 0) - m, err := r.FindStringMatch("aaaMaTcH ThIsbbb") - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - if m == nil { - t.Fatalf("no match when one was expected") - } - if want, got := "aaaMaTcH ThIsbbb", m.String(); want != got { - t.Fatalf("group 0 wanted '%v', got '%v'", want, got) - } -} - -func TestIgnoreCase_Revert(t *testing.T) { - - r := MustCompile("aaa(?-i:match this)bbb", IgnoreCase) - m, err := r.FindStringMatch("AaAMatch thisBBb") - if err != nil { - t.Fatalf("unexpected error: %v", err) - } - if m != nil { - t.Fatalf("had a match but expected no match") - } -} diff --git a/vendor/github.com/dlclark/regexp2/regexp_pcre_test.go b/vendor/github.com/dlclark/regexp2/regexp_pcre_test.go deleted file mode 100644 index 35243b4..0000000 --- a/vendor/github.com/dlclark/regexp2/regexp_pcre_test.go +++ /dev/null @@ -1,409 +0,0 @@ -package regexp2 - -import ( - "bufio" - "bytes" - "fmt" - "log" - "os" - "regexp" - "strconv" - "strings" - "testing" - "time" -) - -// Process the file "testoutput1" from PCRE2 v10.21 (public domain) -var totalCount, failCount = 0, 0 - -func TestPcre_Basics(t *testing.T) { - defer func() { - if failCount > 0 { - t.Logf("%v of %v patterns failed", failCount, totalCount) - } - }() - // open our test patterns file and run through it - // validating results as we go - file, err := os.Open("testoutput1") - if err != nil { - log.Fatal(err) - } - defer file.Close() - - // the high level structure of the file: - // #comments - ignore only outside of the pattern - // pattern (could be multi-line, could be surrounded by "" or //) after the / there are the options some we understand, some we don't - // test case - // 0: success case - // \= Expect no match (ignored) - // another test case - // No Match - // - // another pattern ...etc - - scanner := bufio.NewScanner(file) - // main pattern loop - for scanner.Scan() { - // reading the file a line at a time - line := scanner.Text() - - if trim := strings.TrimSpace(line); trim == "" || strings.HasPrefix(trim, "#") { - // skip blanks and comments - continue - } - - patternStart := line[0] - if patternStart != '/' && patternStart != '"' { - // an error! expected a pattern but we didn't understand what was in the file - t.Fatalf("Unknown file format, expected line to start with '/' or '\"', line in: %v", line) - } - - // start building our pattern, handling multi-line patterns - pattern := line - totalCount++ - - // keep appending the lines to our pattern string until we - // find our closing tag, don't allow the first char to match on the - // line start, but subsequent lines could end on the first char - allowFirst := false - for !containsEnder(line, patternStart, allowFirst) { - if !scanner.Scan() { - // an error! expected more pattern, but got eof - t.Fatalf("Unknown file format, expected more pattern text, but got EOF, pattern so far: %v", pattern) - } - line = scanner.Text() - pattern += fmt.Sprintf("\n%s", line) - allowFirst = true - } - - // we have our raw pattern! -- we need to convert this to a compiled regex - re := compileRawPattern(t, pattern) - - var ( - capsIdx map[int]int - m *Match - toMatch string - ) - // now we need to parse the test cases if there are any - // they start with 4 spaces -- if we don't get a 4-space start then - // we're back out to our next pattern - for scanner.Scan() { - line = scanner.Text() - - // blank line is our separator for a new pattern - if strings.TrimSpace(line) == "" { - break - } - - // could be either " " or "\= Expect" - if strings.HasPrefix(line, "\\= Expect") { - continue - } else if strings.HasPrefix(line, " ") { - // trim off leading spaces for our text to match - toMatch = line[4:] - // trim off trailing spaces too - toMatch = strings.TrimRight(toMatch, " ") - - m = matchString(t, re, toMatch) - - capsIdx = make(map[int]int) - continue - //t.Fatalf("Expected match text to start with 4 spaces, instead got: '%v'", line) - } else if strings.HasPrefix(line, "No match") { - validateNoMatch(t, re, m) - // no match means we're done - continue - } else if subs := matchGroup.FindStringSubmatch(line); len(subs) == 3 { - gIdx, _ := strconv.Atoi(subs[1]) - if _, ok := capsIdx[gIdx]; !ok { - capsIdx[gIdx] = 0 - } - validateMatch(t, re, m, toMatch, subs[2], gIdx, capsIdx[gIdx]) - capsIdx[gIdx]++ - continue - } else { - // no match -- problem - t.Fatalf("Unknown file format, expected match or match group but got '%v'", line) - } - } - - } - - if err := scanner.Err(); err != nil { - log.Fatal(err) - } -} - -var matchGroup = regexp.MustCompile(`^\s*(\d+): (.*)`) - -func problem(t *testing.T, input string, args ...interface{}) { - failCount++ - t.Errorf(input, args...) -} - -func validateNoMatch(t *testing.T, re *Regexp, m *Match) { - if re == nil || m == nil { - return - } - - problem(t, "Expected no match for pattern '%v', but got '%v'", re.pattern, m.String()) -} - -func validateMatch(t *testing.T, re *Regexp, m *Match, toMatch, value string, idx, capIdx int) { - if re == nil { - // already error'd earlier up stream - return - } - - if m == nil { - // we didn't match, but should have - problem(t, "Expected match for pattern '%v' with input '%v', but got no match", re.pattern, toMatch) - return - } - - g := m.Groups() - if len(g) <= idx { - problem(t, "Expected group %v does not exist in pattern '%v' with input '%v'", idx, re.pattern, toMatch) - return - } - - if value == "" { - // this means we shouldn't have a cap for this group - if len(g[idx].Captures) > 0 { - problem(t, "Expected no cap %v in group %v in pattern '%v' with input '%v'", g[idx].Captures[capIdx].String(), idx, re.pattern, toMatch) - } - - return - } - - if len(g[idx].Captures) <= capIdx { - problem(t, "Expected cap %v does not exist in group %v in pattern '%v' with input '%v'", capIdx, idx, re.pattern, toMatch) - return - } - - escp := unEscapeGroup(g[idx].String()) - //escp := unEscapeGroup(g[idx].Captures[capIdx].String()) - if escp != value { - problem(t, "Expected '%v' but got '%v' for cap %v, group %v for pattern '%v' with input '%v'", value, escp, capIdx, idx, re.pattern, toMatch) - return - } -} - -func compileRawPattern(t *testing.T, pattern string) *Regexp { - // check our end for RegexOptions -trim them off - index := strings.LastIndexAny(pattern, "/\"") - // - // Append "= Debug" to compare details between corefx and regexp2 on the PCRE test suite - // - var opts RegexOptions - - if index+1 < len(pattern) { - textOptions := pattern[index+1:] - pattern = pattern[:index+1] - // there are lots of complex options here - for _, textOpt := range strings.Split(textOptions, ",") { - switch textOpt { - case "dupnames": - // we don't know how to handle this... - default: - if strings.Contains(textOpt, "i") { - opts |= IgnoreCase - } - if strings.Contains(textOpt, "s") { - opts |= Singleline - } - if strings.Contains(textOpt, "m") { - opts |= Multiline - } - if strings.Contains(textOpt, "x") { - opts |= IgnorePatternWhitespace - } - } - } - - } - - // trim off first and last char - pattern = pattern[1 : len(pattern)-1] - - defer func() { - if rec := recover(); rec != nil { - problem(t, "PANIC in compiling \"%v\": %v", pattern, rec) - } - }() - re, err := Compile(pattern, opts) - if err != nil { - problem(t, "Error parsing \"%v\": %v", pattern, err) - } - return re -} - -func matchString(t *testing.T, re *Regexp, toMatch string) *Match { - if re == nil { - return nil - } - - re.MatchTimeout = time.Second * 1 - - escp := "" - var err error - if toMatch != "\\" { - escp = unEscapeToMatch(toMatch) - } - m, err := re.FindStringMatch(escp) - if err != nil { - problem(t, "Error matching \"%v\" in pattern \"%v\": %v", toMatch, re.pattern, err) - } - return m -} - -func containsEnder(line string, ender byte, allowFirst bool) bool { - index := strings.LastIndexByte(line, ender) - if index > 0 { - return true - } else if index == 0 && allowFirst { - return true - } - return false -} - -func unEscapeToMatch(line string) string { - idx := strings.IndexRune(line, '\\') - // no slashes means no unescape needed - if idx == -1 { - return line - } - - buf := bytes.NewBufferString(line[:idx]) - // get the runes for the rest of the string -- we're going full parser scan on this - - inEscape := false - // take any \'s and convert them - for i := idx; i < len(line); i++ { - ch := line[i] - if ch == '\\' { - if inEscape { - buf.WriteByte(ch) - } - inEscape = !inEscape - continue - } - if inEscape { - switch ch { - case 'x': - buf.WriteByte(scanHex(line, &i)) - case 'a': - buf.WriteByte(0x07) - case 'b': - buf.WriteByte('\b') - case 'e': - buf.WriteByte(0x1b) - case 'f': - buf.WriteByte('\f') - case 'n': - buf.WriteByte('\n') - case 'r': - buf.WriteByte('\r') - case 't': - buf.WriteByte('\t') - case 'v': - buf.WriteByte(0x0b) - default: - if ch >= '0' && ch <= '7' { - buf.WriteByte(scanOctal(line, &i)) - } else { - buf.WriteByte(ch) - //panic(fmt.Sprintf("unexpected escape '%v' in %v", string(ch), line)) - } - } - inEscape = false - } else { - buf.WriteByte(ch) - } - } - - return buf.String() -} - -func unEscapeGroup(val string) string { - // use hex for chars 0x00-0x1f, 0x7f-0xff - buf := &bytes.Buffer{} - - for i := 0; i < len(val); i++ { - ch := val[i] - if ch <= 0x1f || ch >= 0x7f { - //write it as a \x00 - fmt.Fprintf(buf, "\\x%.2x", ch) - } else { - // write as-is - buf.WriteByte(ch) - } - } - - return buf.String() -} - -func scanHex(line string, idx *int) byte { - if *idx >= len(line)-2 { - panic(fmt.Sprintf("not enough hex chars in %v at %v", line, *idx)) - } - (*idx)++ - d1 := hexDigit(line[*idx]) - (*idx)++ - d2 := hexDigit(line[*idx]) - if d1 < 0 || d2 < 0 { - panic("bad hex chars") - } - - return byte(d1*0x10 + d2) -} - -// Returns n <= 0xF for a hex digit. -func hexDigit(ch byte) int { - - if d := uint(ch - '0'); d <= 9 { - return int(d) - } - - if d := uint(ch - 'a'); d <= 5 { - return int(d + 0xa) - } - - if d := uint(ch - 'A'); d <= 5 { - return int(d + 0xa) - } - - return -1 -} - -// Scans up to three octal digits (stops before exceeding 0377). -func scanOctal(line string, idx *int) byte { - // Consume octal chars only up to 3 digits and value 0377 - - // octals can be 3,2, or 1 digit - c := 3 - - if diff := len(line) - *idx; c > diff { - c = diff - } - - i := 0 - d := int(line[*idx] - '0') - for c > 0 && d <= 7 { - i *= 8 - i += d - - c-- - (*idx)++ - if *idx < len(line) { - d = int(line[*idx] - '0') - } - } - (*idx)-- - - // Octal codes only go up to 255. Any larger and the behavior that Perl follows - // is simply to truncate the high bits. - i &= 0xFF - - return byte(i) -} diff --git a/vendor/github.com/dlclark/regexp2/regexp_performance_test.go b/vendor/github.com/dlclark/regexp2/regexp_performance_test.go deleted file mode 100644 index 17e71df..0000000 --- a/vendor/github.com/dlclark/regexp2/regexp_performance_test.go +++ /dev/null @@ -1,301 +0,0 @@ -package regexp2 - -import ( - "strings" - "testing" -) - -func BenchmarkLiteral(b *testing.B) { - x := strings.Repeat("x", 50) + "y" - b.StopTimer() - re := MustCompile("y", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -func BenchmarkNotLiteral(b *testing.B) { - x := strings.Repeat("x", 50) + "y" - b.StopTimer() - re := MustCompile(".y", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -func BenchmarkMatchClass(b *testing.B) { - b.StopTimer() - x := strings.Repeat("xxxx", 20) + "w" - re := MustCompile("[abcdw]", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - - } -} - -func BenchmarkMatchClass_InRange(b *testing.B) { - b.StopTimer() - // 'b' is between 'a' and 'c', so the charclass - // range checking is no help here. - x := strings.Repeat("bbbb", 20) + "c" - re := MustCompile("[ac]", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -/* -func BenchmarkReplaceAll(b *testing.B) { - x := "abcdefghijklmnopqrstuvwxyz" - b.StopTimer() - re := MustCompile("[cjrw]", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - re.ReplaceAllString(x, "") - } -} -*/ -func BenchmarkAnchoredLiteralShortNonMatch(b *testing.B) { - b.StopTimer() - x := "abcdefghijklmnopqrstuvwxyz" - re := MustCompile("^zbc(d|e)", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); m || err != nil { - b.Fatalf("unexpected match or error! %v", err) - } - } -} - -func BenchmarkAnchoredLiteralLongNonMatch(b *testing.B) { - b.StopTimer() - - data := "abcdefghijklmnopqrstuvwxyz" - x := make([]rune, 32768*len(data)) - for i := 0; i < 32768; /*(2^15)*/ i++ { - for j := 0; j < len(data); j++ { - x[i*len(data)+j] = rune(data[j]) - } - } - - re := MustCompile("^zbc(d|e)", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchRunes(x); m || err != nil { - b.Fatalf("unexpected match or error! %v", err) - } - } -} - -func BenchmarkAnchoredShortMatch(b *testing.B) { - b.StopTimer() - x := "abcdefghijklmnopqrstuvwxyz" - re := MustCompile("^.bc(d|e)", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -func BenchmarkAnchoredLongMatch(b *testing.B) { - b.StopTimer() - data := "abcdefghijklmnopqrstuvwxyz" - x := make([]rune, 32768*len(data)) - for i := 0; i < 32768; /*(2^15)*/ i++ { - for j := 0; j < len(data); j++ { - x[i*len(data)+j] = rune(data[j]) - } - } - - re := MustCompile("^.bc(d|e)", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchRunes(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -func BenchmarkOnePassShortA(b *testing.B) { - b.StopTimer() - x := "abcddddddeeeededd" - re := MustCompile("^.bc(d|e)*$", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -func BenchmarkNotOnePassShortA(b *testing.B) { - b.StopTimer() - x := "abcddddddeeeededd" - re := MustCompile(".bc(d|e)*$", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -func BenchmarkOnePassShortB(b *testing.B) { - b.StopTimer() - x := "abcddddddeeeededd" - re := MustCompile("^.bc(?:d|e)*$", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -func BenchmarkNotOnePassShortB(b *testing.B) { - b.StopTimer() - x := "abcddddddeeeededd" - re := MustCompile(".bc(?:d|e)*$", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -func BenchmarkOnePassLongPrefix(b *testing.B) { - b.StopTimer() - x := "abcdefghijklmnopqrstuvwxyz" - re := MustCompile("^abcdefghijklmnopqrstuvwxyz.*$", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -func BenchmarkOnePassLongNotPrefix(b *testing.B) { - b.StopTimer() - x := "abcdefghijklmnopqrstuvwxyz" - re := MustCompile("^.bcdefghijklmnopqrstuvwxyz.*$", 0) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := re.MatchString(x); !m || err != nil { - b.Fatalf("no match or error! %v", err) - } - } -} - -var text []rune - -func makeText(n int) []rune { - if len(text) >= n { - return text[:n] - } - text = make([]rune, n) - x := ^uint32(0) - for i := range text { - x += x - x ^= 1 - if int32(x) < 0 { - x ^= 0x88888eef - } - if x%31 == 0 { - text[i] = '\n' - } else { - text[i] = rune(x%(0x7E+1-0x20) + 0x20) - } - } - return text -} - -func benchmark(b *testing.B, re string, n int) { - r := MustCompile(re, 0) - t := makeText(n) - b.ResetTimer() - b.SetBytes(int64(n)) - for i := 0; i < b.N; i++ { - if m, err := r.MatchRunes(t); m { - b.Fatal("match!") - } else if err != nil { - b.Fatalf("Err %v", err) - } - } -} - -const ( - easy0 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ$" - easy1 = "A[AB]B[BC]C[CD]D[DE]E[EF]F[FG]G[GH]H[HI]I[IJ]J$" - medium = "[XYZ]ABCDEFGHIJKLMNOPQRSTUVWXYZ$" - hard = "[ -~]*ABCDEFGHIJKLMNOPQRSTUVWXYZ$" - parens = "([ -~])*(A)(B)(C)(D)(E)(F)(G)(H)(I)(J)(K)(L)(M)" + - "(N)(O)(P)(Q)(R)(S)(T)(U)(V)(W)(X)(Y)(Z)$" -) - -func BenchmarkMatchEasy0_32(b *testing.B) { benchmark(b, easy0, 32<<0) } -func BenchmarkMatchEasy0_1K(b *testing.B) { benchmark(b, easy0, 1<<10) } -func BenchmarkMatchEasy0_32K(b *testing.B) { benchmark(b, easy0, 32<<10) } -func BenchmarkMatchEasy0_1M(b *testing.B) { benchmark(b, easy0, 1<<20) } -func BenchmarkMatchEasy0_32M(b *testing.B) { benchmark(b, easy0, 32<<20) } -func BenchmarkMatchEasy1_32(b *testing.B) { benchmark(b, easy1, 32<<0) } -func BenchmarkMatchEasy1_1K(b *testing.B) { benchmark(b, easy1, 1<<10) } -func BenchmarkMatchEasy1_32K(b *testing.B) { benchmark(b, easy1, 32<<10) } -func BenchmarkMatchEasy1_1M(b *testing.B) { benchmark(b, easy1, 1<<20) } -func BenchmarkMatchEasy1_32M(b *testing.B) { benchmark(b, easy1, 32<<20) } -func BenchmarkMatchMedium_32(b *testing.B) { benchmark(b, medium, 32<<0) } -func BenchmarkMatchMedium_1K(b *testing.B) { benchmark(b, medium, 1<<10) } -func BenchmarkMatchMedium_32K(b *testing.B) { benchmark(b, medium, 32<<10) } -func BenchmarkMatchMedium_1M(b *testing.B) { benchmark(b, medium, 1<<20) } -func BenchmarkMatchMedium_32M(b *testing.B) { benchmark(b, medium, 32<<20) } -func BenchmarkMatchHard_32(b *testing.B) { benchmark(b, hard, 32<<0) } -func BenchmarkMatchHard_1K(b *testing.B) { benchmark(b, hard, 1<<10) } -func BenchmarkMatchHard_32K(b *testing.B) { benchmark(b, hard, 32<<10) } -func BenchmarkMatchHard_1M(b *testing.B) { benchmark(b, hard, 1<<20) } -func BenchmarkMatchHard_32M(b *testing.B) { benchmark(b, hard, 32<<20) } - -// TestProgramTooLongForBacktrack tests that a regex which is too long -// for the backtracker still executes properly. -func TestProgramTooLongForBacktrack(t *testing.T) { - longRegex := MustCompile(`(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|twentyone|twentytwo|twentythree|twentyfour|twentyfive|twentysix|twentyseven|twentyeight|twentynine|thirty|thirtyone|thirtytwo|thirtythree|thirtyfour|thirtyfive|thirtysix|thirtyseven|thirtyeight|thirtynine|forty|fortyone|fortytwo|fortythree|fortyfour|fortyfive|fortysix|fortyseven|fortyeight|fortynine|fifty|fiftyone|fiftytwo|fiftythree|fiftyfour|fiftyfive|fiftysix|fiftyseven|fiftyeight|fiftynine|sixty|sixtyone|sixtytwo|sixtythree|sixtyfour|sixtyfive|sixtysix|sixtyseven|sixtyeight|sixtynine|seventy|seventyone|seventytwo|seventythree|seventyfour|seventyfive|seventysix|seventyseven|seventyeight|seventynine|eighty|eightyone|eightytwo|eightythree|eightyfour|eightyfive|eightysix|eightyseven|eightyeight|eightynine|ninety|ninetyone|ninetytwo|ninetythree|ninetyfour|ninetyfive|ninetysix|ninetyseven|ninetyeight|ninetynine|onehundred)`, 0) - - if m, err := longRegex.MatchString("two"); !m { - t.Errorf("longRegex.MatchString(\"two\") was false, want true") - } else if err != nil { - t.Errorf("Error: %v", err) - } - if m, err := longRegex.MatchString("xxx"); m { - t.Errorf("longRegex.MatchString(\"xxx\") was true, want false") - } else if err != nil { - t.Errorf("Error: %v", err) - } -} - -func BenchmarkLeading(b *testing.B) { - b.StopTimer() - r := MustCompile("[a-q][^u-z]{13}x", 0) - inp := makeText(1000000) - b.StartTimer() - for i := 0; i < b.N; i++ { - if m, err := r.MatchRunes(inp); !m { - b.Errorf("Expected match") - } else if err != nil { - b.Errorf("Error: %v", err) - } - } -} diff --git a/vendor/github.com/dlclark/regexp2/regexp_test.go b/vendor/github.com/dlclark/regexp2/regexp_test.go deleted file mode 100644 index a332029..0000000 --- a/vendor/github.com/dlclark/regexp2/regexp_test.go +++ /dev/null @@ -1,759 +0,0 @@ -package regexp2 - -import ( - "reflect" - "testing" - "time" - - "github.com/dlclark/regexp2/syntax" -) - -func TestBacktrack_CatastrophicTimeout(t *testing.T) { - r, err := Compile("(.+)*\\?", 0) - r.MatchTimeout = time.Millisecond * 1 - t.Logf("code dump: %v", r.code.Dump()) - m, err := r.FindStringMatch("Do you think you found the problem string!") - if err == nil { - t.Errorf("expected timeout err") - } - if m != nil { - t.Errorf("Expected no match") - } -} - -func TestSetPrefix(t *testing.T) { - r := MustCompile(`^\s*-TEST`, 0) - if r.code.FcPrefix == nil { - t.Fatalf("Expected prefix set [-\\s] but was nil") - } - if r.code.FcPrefix.PrefixSet.String() != "[-\\s]" { - t.Fatalf("Expected prefix set [\\s-] but was %v", r.code.FcPrefix.PrefixSet.String()) - } -} - -func TestSetInCode(t *testing.T) { - r := MustCompile(`(?\s*(?.+))`, 0) - t.Logf("code dump: %v", r.code.Dump()) - if want, got := 1, len(r.code.Sets); want != got { - t.Fatalf("r.code.Sets wanted %v, got %v", want, got) - } - if want, got := "[\\s]", r.code.Sets[0].String(); want != got { - t.Fatalf("first set wanted %v, got %v", want, got) - } -} - -func TestRegexp_Basic(t *testing.T) { - r, err := Compile("test(?ing)?", 0) - //t.Logf("code dump: %v", r.code.Dump()) - - if err != nil { - t.Errorf("unexpected compile err: %v", err) - } - m, err := r.FindStringMatch("this is a testing stuff") - if err != nil { - t.Errorf("unexpected match err: %v", err) - } - if m == nil { - t.Error("Nil match, expected success") - } else { - //t.Logf("Match: %v", m.dump()) - } -} - -// check all our functions and properties around basic capture groups and referential for Group 0 -func TestCapture_Basic(t *testing.T) { - r := MustCompile(`.*\B(SUCCESS)\B.*`, 0) - m, err := r.FindStringMatch("adfadsfSUCCESSadsfadsf") - if err != nil { - t.Fatalf("Unexpected match error: %v", err) - } - - if m == nil { - t.Fatalf("Should have matched") - } - if want, got := "adfadsfSUCCESSadsfadsf", m.String(); want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - if want, got := 0, m.Index; want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - if want, got := 22, m.Length; want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - if want, got := 1, len(m.Captures); want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - - if want, got := m.String(), m.Captures[0].String(); want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - if want, got := 0, m.Captures[0].Index; want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - if want, got := 22, m.Captures[0].Length; want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - - g := m.Groups() - if want, got := 2, len(g); want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - // group 0 is always the match - if want, got := m.String(), g[0].String(); want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - if want, got := 1, len(g[0].Captures); want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - // group 0's capture is always the match - if want, got := m.Captures[0].String(), g[0].Captures[0].String(); want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - - // group 1 is our first explicit group (unnamed) - if want, got := 7, g[1].Index; want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - if want, got := 7, g[1].Length; want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - if want, got := "SUCCESS", g[1].String(); want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } -} - -func TestEscapeUnescape_Basic(t *testing.T) { - s1 := "#$^*+(){}<>\\|. " - s2 := Escape(s1) - s3, err := Unescape(s2) - if err != nil { - t.Fatalf("Unexpected error during unescape: %v", err) - } - - //confirm one way - if want, got := `\#\$\^\*\+\(\)\{\}<>\\\|\.\ `, s2; want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - - //confirm round-trip - if want, got := s1, s3; want != got { - t.Fatalf("Wanted '%v'\nGot '%v'", want, got) - } - -} - -func TestGroups_Basic(t *testing.T) { - type d struct { - p string - s string - name []string - num []int - strs []string - } - data := []d{ - d{"(?\\S+)\\s(?\\S+)", // example - "Ryan Byington", - []string{"0", "first_name", "last_name"}, - []int{0, 1, 2}, - []string{"Ryan Byington", "Ryan", "Byington"}}, - d{"((?abc)\\d+)?(?xyz)(.*)", // example - "abc208923xyzanqnakl", - []string{"0", "1", "2", "One", "Two"}, - []int{0, 1, 2, 3, 4}, - []string{"abc208923xyzanqnakl", "abc208923", "anqnakl", "abc", "xyz"}}, - d{"((?<256>abc)\\d+)?(?<16>xyz)(.*)", // numeric names - "0272saasdabc8978xyz][]12_+-", - []string{"0", "1", "2", "16", "256"}, - []int{0, 1, 2, 16, 256}, - []string{"abc8978xyz][]12_+-", "abc8978", "][]12_+-", "xyz", "abc"}}, - d{"((?<4>abc)(?\\d+))?(?<2>xyz)(?.*)", // mix numeric and string names - "0272saasdabc8978xyz][]12_+-", - []string{"0", "1", "2", "digits", "4", "everything_else"}, - []int{0, 1, 2, 3, 4, 5}, - []string{"abc8978xyz][]12_+-", "abc8978", "xyz", "8978", "abc", "][]12_+-"}}, - d{"(?\\S+)\\s(?\\S+)", // dupe string names - "Ryan Byington", - []string{"0", "first_name"}, - []int{0, 1}, - []string{"Ryan Byington", "Byington"}}, - d{"(?<15>\\S+)\\s(?<15>\\S+)", // dupe numeric names - "Ryan Byington", - []string{"0", "15"}, - []int{0, 15}, - []string{"Ryan Byington", "Byington"}}, - // *** repeated from above, but with alt cap syntax *** - d{"(?'first_name'\\S+)\\s(?'last_name'\\S+)", //example - "Ryan Byington", - []string{"0", "first_name", "last_name"}, - []int{0, 1, 2}, - []string{"Ryan Byington", "Ryan", "Byington"}}, - d{"((?'One'abc)\\d+)?(?'Two'xyz)(.*)", // example - "abc208923xyzanqnakl", - []string{"0", "1", "2", "One", "Two"}, - []int{0, 1, 2, 3, 4}, - []string{"abc208923xyzanqnakl", "abc208923", "anqnakl", "abc", "xyz"}}, - d{"((?'256'abc)\\d+)?(?'16'xyz)(.*)", // numeric names - "0272saasdabc8978xyz][]12_+-", - []string{"0", "1", "2", "16", "256"}, - []int{0, 1, 2, 16, 256}, - []string{"abc8978xyz][]12_+-", "abc8978", "][]12_+-", "xyz", "abc"}}, - d{"((?'4'abc)(?'digits'\\d+))?(?'2'xyz)(?'everything_else'.*)", // mix numeric and string names - "0272saasdabc8978xyz][]12_+-", - []string{"0", "1", "2", "digits", "4", "everything_else"}, - []int{0, 1, 2, 3, 4, 5}, - []string{"abc8978xyz][]12_+-", "abc8978", "xyz", "8978", "abc", "][]12_+-"}}, - d{"(?'first_name'\\S+)\\s(?'first_name'\\S+)", // dupe string names - "Ryan Byington", - []string{"0", "first_name"}, - []int{0, 1}, - []string{"Ryan Byington", "Byington"}}, - d{"(?'15'\\S+)\\s(?'15'\\S+)", // dupe numeric names - "Ryan Byington", - []string{"0", "15"}, - []int{0, 15}, - []string{"Ryan Byington", "Byington"}}, - } - - fatalf := func(re *Regexp, v d, format string, args ...interface{}) { - args = append(args, v, re.code.Dump()) - - t.Fatalf(format+" using test data: %#v\ndump:%v", args...) - } - - validateGroupNamesNumbers := func(re *Regexp, v d) { - if len(v.name) != len(v.num) { - fatalf(re, v, "Invalid data, group name count and number count must match") - } - - groupNames := re.GetGroupNames() - if !reflect.DeepEqual(groupNames, v.name) { - fatalf(re, v, "group names expected: %v, actual: %v", v.name, groupNames) - } - groupNums := re.GetGroupNumbers() - if !reflect.DeepEqual(groupNums, v.num) { - fatalf(re, v, "group numbers expected: %v, actual: %v", v.num, groupNums) - } - // make sure we can freely get names and numbers from eachother - for i := range groupNums { - if want, got := groupNums[i], re.GroupNumberFromName(groupNames[i]); want != got { - fatalf(re, v, "group num from name Wanted '%v'\nGot '%v'", want, got) - } - if want, got := groupNames[i], re.GroupNameFromNumber(groupNums[i]); want != got { - fatalf(re, v, "group name from num Wanted '%v'\nGot '%v'", want, got) - } - } - } - - for _, v := range data { - // compile the regex - re := MustCompile(v.p, 0) - - // validate our group name/num info before execute - validateGroupNamesNumbers(re, v) - - m, err := re.FindStringMatch(v.s) - if err != nil { - fatalf(re, v, "Unexpected error in match: %v", err) - } - if m == nil { - fatalf(re, v, "Match is nil") - } - if want, got := len(v.strs), m.GroupCount(); want != got { - fatalf(re, v, "GroupCount() Wanted '%v'\nGot '%v'", want, got) - } - g := m.Groups() - if want, got := len(v.strs), len(g); want != got { - fatalf(re, v, "len(m.Groups()) Wanted '%v'\nGot '%v'", want, got) - } - // validate each group's value from the execute - for i := range v.name { - grp1 := m.GroupByName(v.name[i]) - grp2 := m.GroupByNumber(v.num[i]) - // should be identical reference - if grp1 != grp2 { - fatalf(re, v, "Expected GroupByName and GroupByNumber to return same result for %v, %v", v.name[i], v.num[i]) - } - if want, got := v.strs[i], grp1.String(); want != got { - fatalf(re, v, "Value[%v] Wanted '%v'\nGot '%v'", i, want, got) - } - } - - // validate our group name/num info after execute - validateGroupNamesNumbers(re, v) - } -} - -func TestErr_GroupName(t *testing.T) { - // group 0 is off limits - if _, err := Compile("foo(?<0>bar)", 0); err == nil { - t.Fatalf("zero group, expected error during compile") - } else if want, got := "error parsing regexp: capture number cannot be zero in `foo(?<0>bar)`", err.Error(); want != got { - t.Fatalf("invalid error text, want '%v', got '%v'", want, got) - } - if _, err := Compile("foo(?'0'bar)", 0); err == nil { - t.Fatalf("zero group, expected error during compile") - } else if want, got := "error parsing regexp: capture number cannot be zero in `foo(?'0'bar)`", err.Error(); want != got { - t.Fatalf("invalid error text, want '%v', got '%v'", want, got) - } - - // group tag can't start with a num - if _, err := Compile("foo(?<1bar>)", 0); err == nil { - t.Fatalf("invalid group name, expected error during compile") - } else if want, got := "error parsing regexp: invalid group name: group names must begin with a word character and have a matching terminator in `foo(?<1bar>)`", err.Error(); want != got { - t.Fatalf("invalid error text, want '%v', got '%v'", want, got) - } - if _, err := Compile("foo(?'1bar')", 0); err == nil { - t.Fatalf("invalid group name, expected error during compile") - } else if want, got := "error parsing regexp: invalid group name: group names must begin with a word character and have a matching terminator in `foo(?'1bar')`", err.Error(); want != got { - t.Fatalf("invalid error text, want '%v', got '%v'", want, got) - } - - // missing closing group tag - if _, err := Compile("foo(? 0 { - buf.WriteString(string(text[:prevat])) - } - - for i := len(al) - 1; i >= 0; i-- { - buf.WriteString(al[i]) - } - } - - return buf.String(), nil -} - -// Given a Match, emits into the StringBuilder the evaluated -// substitution pattern. -func replacementImpl(data *syntax.ReplacerData, buf *bytes.Buffer, m *Match) { - for _, r := range data.Rules { - - if r >= 0 { // string lookup - buf.WriteString(data.Strings[r]) - } else if r < -replaceSpecials { // group lookup - m.groupValueAppendToBuf(-replaceSpecials-1-r, buf) - } else { - switch -replaceSpecials - 1 - r { // special insertion patterns - case replaceLeftPortion: - for i := 0; i < m.Index; i++ { - buf.WriteRune(m.text[i]) - } - case replaceRightPortion: - for i := m.Index + m.Length; i < len(m.text); i++ { - buf.WriteRune(m.text[i]) - } - case replaceLastGroup: - m.groupValueAppendToBuf(m.GroupCount()-1, buf) - case replaceWholeString: - for i := 0; i < len(m.text); i++ { - buf.WriteRune(m.text[i]) - } - } - } - } -} - -func replacementImplRTL(data *syntax.ReplacerData, al *[]string, m *Match) { - l := *al - buf := &bytes.Buffer{} - - for _, r := range data.Rules { - buf.Reset() - if r >= 0 { // string lookup - l = append(l, data.Strings[r]) - } else if r < -replaceSpecials { // group lookup - m.groupValueAppendToBuf(-replaceSpecials-1-r, buf) - l = append(l, buf.String()) - } else { - switch -replaceSpecials - 1 - r { // special insertion patterns - case replaceLeftPortion: - for i := 0; i < m.Index; i++ { - buf.WriteRune(m.text[i]) - } - case replaceRightPortion: - for i := m.Index + m.Length; i < len(m.text); i++ { - buf.WriteRune(m.text[i]) - } - case replaceLastGroup: - m.groupValueAppendToBuf(m.GroupCount()-1, buf) - case replaceWholeString: - for i := 0; i < len(m.text); i++ { - buf.WriteRune(m.text[i]) - } - } - l = append(l, buf.String()) - } - } - - *al = l -} diff --git a/vendor/github.com/dlclark/regexp2/replace_test.go b/vendor/github.com/dlclark/regexp2/replace_test.go deleted file mode 100644 index 54937c9..0000000 --- a/vendor/github.com/dlclark/regexp2/replace_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package regexp2 - -import ( - "strconv" - "testing" -) - -func TestReplace_Basic(t *testing.T) { - re := MustCompile(`test`, 0) - str, err := re.Replace("this is a test", "unit", -1, -1) - if err != nil { - t.Fatalf("Unexpected err: %v", err) - } - if want, got := "this is a unit", str; want != got { - t.Fatalf("Replace failed, wanted %v, got %v", want, got) - } -} - -func TestReplace_NamedGroup(t *testing.T) { - re := MustCompile(`[^ ]+\s(?