Morten Lauritsen Khodabocus <mlauri...@gmail.com> writes: > Two regular expressions should match the same thing, but for some reason > do not: > [[ '/home/' =~ [^/]+ ]]; echo ${bash_remat...@]} > and > [[ '/home/' =~ [^/]* ]]; echo ${bash_remat...@]} > the first matches 'home', the second matches nothing. The only difference > is * vs. + AFAICT, both expressions should match 'home'.
"[^/]*" matches the null string at the start of '/home/', and there is no reason for the matcher to try another match. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."