Results for regex.test.sh

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

46 passed, 5 ok, 3 known unimplemented, 0 known bugs, 3 failed, 0 skipped

Details on runs that didn't PASS

bash3 Regex quoted with single quotes

stdout:
stderr: 
bash4 Regex quoted with double quotes

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

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

stdout:
stderr: 
zsh10 Malformed regex

stdout:
stderr: 
zsh: parse error near `)'
osh11 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 1 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
                 ^
Invalid regex: '([a'
---
Line 1 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 1 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
  ^~
Error parsing [[
---
Line 0 of '<unknown>'
  <no position info for token>
Error parsing AndOr in ParseCommandTerm
---
osh_ALT11 Regex with char class

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

stdout:
stderr: 
Error compiling regex: Un-matched bracket list operators.
Line 1 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
                 ^
Invalid regex: '([a'
---
Line 1 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 1 of '<stdin>'
  [[ 'ba ba ' =~ ([a b]+) ]] && echo true
  ^~
Error parsing [[
---
Line 0 of '<unknown>'
  <no position info for token>
Error parsing AndOr in ParseCommandTerm
---
zsh12 Operators lose meaning in () in regex state (BASH_REGEX_CAHRS)

stdout:
stderr: 
zsh: parse error near `<'
osh12 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 1 of '<stdin>'
  [[ '< >' =~ (< >) ]] && echo true
              ^
Invalid regex: '('
---
Line 1 of '<stdin>'
  [[ '< >' =~ (< >) ]] && echo true
              ^
Unexpected extra word (CompoundWord parts:[(LiteralPart token:(token id:Lit_Chars val:'(' span_id:8))])
---
Line 1 of '<stdin>'
  [[ '< >' =~ (< >) ]] && echo true
  ^~
Error parsing [[
---
Line 0 of '<unknown>'
  <no position info for token>
Error parsing AndOr in ParseCommandTerm
---
osh_ALT12 Operators lose meaning in () in regex state (BASH_REGEX_CAHRS)

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

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

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

stdout:
stderr: 
zsh: failed to compile regex: Invalid preceding regular expression
osh14 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 1 of '<stdin>'
  [[ { =~ "{" ]] && echo true
           ^
Invalid regex: '{'
---
Line 1 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 1 of '<stdin>'
  [[ { =~ "{" ]] && echo true
  ^~
Error parsing [[
---
Line 0 of '<unknown>'
  <no position info for token>
Error parsing AndOr in ParseCommandTerm
---
osh_ALT14 Double quoted regex gets regex-escaped

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

stdout:
stderr: 
Error compiling regex: Invalid use of repetition operators such as using '*' as the first character.
Line 1 of '<stdin>'
  [[ { =~ "{" ]] && echo true
           ^
Invalid regex: '{'
---
Line 1 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 1 of '<stdin>'
  [[ { =~ "{" ]] && echo true
  ^~
Error parsing [[
---
Line 0 of '<unknown>'
  <no position info for token>
Error parsing AndOr in ParseCommandTerm
---