Skip to main content
deleted 4 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k
pattern=${ printf '%P\n'%P "regexp"; }
pattern=${ printf '%P\n' "regexp"; }
pattern=${ printf %P "regexp"; }
added 197 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

Later (some time between 2001 and 2003in ksh93l in 2001) it also incorporated regular expressions in its globs like with the ~(E)regex syntax for extended regular expressions, so you can do:

Later (some time between 2001 and 2003) it also incorporated regular expressions in its globs like with the ~(E)regex syntax for extended regular expressions, so you can do:

Later (in ksh93l in 2001) it also incorporated regular expressions in its globs like with the ~(E)regex syntax for extended regular expressions, so you can do:

added 197 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

bash added a =~ operator in bash 3.0bash added a =~ operator in bash 3.0 (in 2004). Using extended regular expressions. That was added shortly after by ksh93 and zsh as well (again with differences).

ksh93 and bash-3.2 and abovebash-3.2 and above (when the compat31 option is not enabled) use quoting to escape regexp operator causing all sorts of confusion (and it's very buggy in ksh93) and meaning it can't be used the same way with the [ command there. zsh doesn't have that problem (quotes are used for shell quoting, and backslash to escape regex operator as usual), so the =~ operator works in zsh's [ command (though itself needs quoted since =foo is a filename expansion operator in zsh).

bash added a =~ operator in bash 3.0 (in 2004). Using extended regular expressions. That was added shortly after by ksh93 and zsh as well (again with differences).

ksh93 and bash-3.2 and above (when the compat31 option is not enabled) use quoting to escape regexp operator causing all sorts of confusion and meaning it can't be used with the [ command there. zsh doesn't have that problem (quotes are used for shell quoting, and backslash to escape regex operator as usual), so the =~ operator works in zsh's [ command (though itself needs quoted since =foo is a filename expansion operator in zsh).

bash added a =~ operator in bash 3.0 (in 2004). Using extended regular expressions. That was added shortly after by ksh93 and zsh as well (again with differences).

ksh93 and bash-3.2 and above (when the compat31 option is not enabled) use quoting to escape regexp operator causing all sorts of confusion (and it's very buggy in ksh93) and meaning it can't be used the same way with the [ command there. zsh doesn't have that problem (quotes are used for shell quoting, and backslash to escape regex operator as usual), so the =~ operator works in zsh's [ command (though itself needs quoted since =foo is a filename expansion operator in zsh).

added 119 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k
Loading
added 5 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k
Loading
added 74 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k
Loading
added 35 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k
Loading
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k
Loading