Re: Difference in POSIX regular expression for bash's '=~' operator and POSIXLY_CORRECT grep -E

2025-05-20 Thread FunnyMan Computer
Andreas Schwab * Why? There are no subexpression in your regexps. My bad. I really should have looked twice on what the manual says on BASH_REMATCH and checked up on what subexpressions is supposed to result. I thought they were a synonym for multiple results returned by a global flag, think

Re: Difference in POSIX regular expression for bash's '=~' operator and POSIXLY_CORRECT grep -E

2025-05-20 Thread Wiley Young
> > For accuracy, under POSIX, `grep` indeed is required to always print whole lines, however GNU `grep` has... -o, --only-matching Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line. ...and BSD `grep` has...

Re: Difference in POSIX regular expression for bash's '=~' operator and POSIXLY_CORRECT grep -E

2025-05-20 Thread Andreas Schwab
On Mai 20 2025, FunnyMan Computer wrote: > In both cases, ${BASH_REMATCH[1]} should also have results stored. Why? There are no subexpression in your regexps. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for

Re: Difference in POSIX regular expression for bash's '=~' operator and POSIXLY_CORRECT grep -E

2025-05-20 Thread Greg Wooledge
On Tue, May 20, 2025 at 19:08:10 +, FunnyMan Computer wrote: > I failed multiple times on getting similar results to what I was > expecting from using grep just using the [a-z] and [a-z]+ classes - > expecting multiple results from $BASH_REMATCH but it's only picking >

Re: Difference in POSIX regular expression for bash's '=~' operator and POSIXLY_CORRECT grep -E

2025-05-20 Thread Chet Ramey
On 5/20/25 3:08 PM, FunnyMan Computer wrote: Bash Version: 5.2 Patch Level: 37 Release Status: release Description:   Bash's '=~' extended POSIX regex seems to behave very different to the way grep's -E flag seems to deal with regular expressions. Bash doesn't provide its own impleme

Difference in POSIX regular expression for bash's '=~' operator and POSIXLY_CORRECT grep -E

2025-05-20 Thread FunnyMan Computer
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-p