Suppose extglob is turned on in Bash (I use 5.0.11(1)-release (x86_64-apple-darwin18.6.0)) and we have a file with the name list89988777,,,,,+--.txt. I cannot get a , to work in extglob pattern with [...] unless I escape not just the comma but all that goes with it if the , is the first in a [..], which does not make sense to me. Hence:
ls *+([[:digit:]]|[\,\-\+]).txt works, so does
ls *+([[:digit:]]|[[:punct:]]|[-\,+]).txt as well as
ls *+([[:digit:]]|[[:punct:]]|[-+\,]).txt
but
ls *+([[:digit:]]|[\,-+]).txt does not work.
Problem can be solved with ls *+([[:digit:]]|[[:punct:]]|[-+]).txt, which works, or for that matter with ls *+([[:digit:]]|[[:punct:]]|[,-+]).txt which also works. But why is escaping , and all the other chars in a [...] necessary if the first char is a ,?
-that creates the unintended pattern.