Results for regex.test.sh

casebashzshoshosh-byterundescription
0pass N-I pass pass BASH_REMATCH
details
1pass pass pass pass Match is unanchored at both ends
2pass pass pass pass Failed match
3pass pass pass pass Regex quoted with \ -- preferred in bash
4ok pass pass pass Regex quoted with single quotes
details
5ok pass pass pass Regex quoted with double quotes
details
6pass pass pass pass Fix single quotes by storing in variable
7pass pass pass pass Fix single quotes by storing in variable
8ok pass pass pass Double quoting pat variable -- again bash doesn't like it.
details
9pass ok pass pass Regex with == and not =~ is parse error, different lexer mode required
details
10pass pass pass pass Omitting ( )
11pass ok pass pass Malformed regex
details
12pass pass FAIL FAIL Regex with char class
detailsdetails
13pass N-I FAIL FAIL Operators lose meaning in () in regex state (BASH_REGEX_CAHRS)
detailsdetailsdetails
14pass N-I pass pass Regex with |
details
15pass N-I FAIL FAIL Double quoted regex gets regex-escaped
detailsdetailsdetails

49 passed, 5 ok, 4 known unimplemented, 0 known bugs, 3 failed, 0 skipped

Details on runs that didn't PASS

zsh0 BASH_REMATCH

stdout:
['']
stderr:
bash4 Regex quoted with single quotes

stdout:
stderr: 
bash5 Regex quoted with double quotes

stdout:
stderr: 
bash8 Double quoting pat variable -- again bash doesn't like it.

stdout:
stderr: 
zsh9 Regex with == and not =~ is parse error, different lexer mode required

stdout:
stderr: 
zsh11 Malformed regex

stdout:
stderr: 
zsh: parse error near `)'
osh12 Regex with char class

[osh stdout] Expected 'true\n', got ''
[osh status] Expected 0, got 2

stdout:
stderr: 
Error compiling regex: Un-matched bracket list operators.
Line 2 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
                 ^
Invalid regex: '([a'
---
Line 2 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
                 ^
Unexpected extra word (CompoundWord
  parts: [
    (LiteralPart token:(token id:Lit_Chars val:'(' span_id:8))
    (LiteralPart token:(token id:Lit_Other val:'[' span_id:9))
    (LiteralPart token:(token id:Lit_Chars val:a span_id:10))
  ]
)
---
Line 2 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
  ^~
Error parsing [[
---
*** Error has no source location info ***
Error parsing AndOr in ParseCommandTerm
---
osh-byterun12 Regex with char class

[osh-byterun stdout] Expected 'true\n', got ''
[osh-byterun status] Expected 0, got 2

stdout:
stderr: 
Error compiling regex: Un-matched bracket list operators.
Line 2 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
                 ^
Invalid regex: '([a'
---
Line 2 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
                 ^
Unexpected extra word (CompoundWord
  parts: [
    (LiteralPart token:(token id:Lit_Chars val:'(' span_id:8))
    (LiteralPart token:(token id:Lit_Other val:'[' span_id:9))
    (LiteralPart token:(token id:Lit_Chars val:a span_id:10))
  ]
)
---
Line 2 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
  ^~
Error parsing [[
---
*** Error has no source location info ***
Error parsing AndOr in ParseCommandTerm
---
zsh13 Operators lose meaning in () in regex state (BASH_REGEX_CAHRS)

stdout:
stderr: 
zsh: parse error near `<'
osh13 Operators lose meaning in () in regex state (BASH_REGEX_CAHRS)

[osh stdout] Expected 'true\n', got ''
[osh status] Expected 0, got 2

stdout:
stderr: 
Error compiling regex: Un-matched parenthesis group operators.
Line 2 of '<stdin>'
  [[ '< >' =~ (< >) ]] && echo true
              ^
Invalid regex: '('
---
Line 2 of '<stdin>'
  [[ '< >' =~ (< >) ]] && echo true
              ^
Unexpected extra word (CompoundWord parts:[(LiteralPart token:(token id:Lit_Chars val:'(' span_id:8))])
---
Line 2 of '<stdin>'
  [[ '< >' =~ (< >) ]] && echo true
  ^~
Error parsing [[
---
*** Error has no source location info ***
Error parsing AndOr in ParseCommandTerm
---
osh-byterun13 Operators lose meaning in () in regex state (BASH_REGEX_CAHRS)

[osh-byterun stdout] Expected 'true\n', got ''
[osh-byterun status] Expected 0, got 2

stdout:
stderr: 
Error compiling regex: Un-matched parenthesis group operators.
Line 2 of '<stdin>'
  [[ '< >' =~ (< >) ]] && echo true
              ^
Invalid regex: '('
---
Line 2 of '<stdin>'
  [[ '< >' =~ (< >) ]] && echo true
              ^
Unexpected extra word (CompoundWord parts:[(LiteralPart token:(token id:Lit_Chars val:'(' span_id:8))])
---
Line 2 of '<stdin>'
  [[ '< >' =~ (< >) ]] && echo true
  ^~
Error parsing [[
---
*** Error has no source location info ***
Error parsing AndOr in ParseCommandTerm
---
zsh14 Regex with |

stdout:
stderr: 
zsh: parse error near `|'
zsh15 Double quoted regex gets regex-escaped

stdout:
stderr: 
zsh: failed to compile regex: Invalid preceding regular expression
osh15 Double quoted regex gets regex-escaped

[osh stdout] Expected 'true\n', got ''
[osh status] Expected 0, got 2

stdout:
stderr: 
Error compiling regex: Invalid use of repetition operators such as using '*' as the first character.
Line 2 of '<stdin>'
  [[ { =~ "{" ]] && echo true
           ^
Invalid regex: '{'
---
Line 2 of '<stdin>'
  [[ { =~ "{" ]] && echo true
           ^
Unexpected extra word (CompoundWord
  parts: [
    (DoubleQuotedPart
      parts: [(LiteralPart token:(token id:Lit_Chars val:'{' span_id:7))]
      spids: [6 8]
    )
  ]
)
---
Line 2 of '<stdin>'
  [[ { =~ "{" ]] && echo true
  ^~
Error parsing [[
---
*** Error has no source location info ***
Error parsing AndOr in ParseCommandTerm
---
osh-byterun15 Double quoted regex gets regex-escaped

[osh-byterun stdout] Expected 'true\n', got ''
[osh-byterun status] Expected 0, got 2

stdout:
stderr: 
Error compiling regex: Invalid use of repetition operators such as using '*' as the first character.
Line 2 of '<stdin>'
  [[ { =~ "{" ]] && echo true
           ^
Invalid regex: '{'
---
Line 2 of '<stdin>'
  [[ { =~ "{" ]] && echo true
           ^
Unexpected extra word (CompoundWord
  parts: [
    (DoubleQuotedPart
      parts: [(LiteralPart token:(token id:Lit_Chars val:'{' span_id:7))]
      spids: [6 8]
    )
  ]
)
---
Line 2 of '<stdin>'
  [[ { =~ "{" ]] && echo true
  ^~
Error parsing [[
---
*** Error has no source location info ***
Error parsing AndOr in ParseCommandTerm
---