regexp failing .... not sure why

Maybe you can try to proceed by inclusion, knowing the format of a limits.conf :
^\s*[*a-z]+\s+soft\s+nofile

R.