This output is rather self-explanatory:
XXXXX@debianvirtualbox:~$ locate -r "^/var/lib/tomcat[0-9]/.*" -l 10
/var/lib/tomcat8/conf
/var/lib/tomcat8/lib
/var/lib/tomcat8/logs
/var/lib/tomcat8/webapps
/var/lib/tomcat8/work
/var/lib/tomcat8/webapps/ROOT
/var/lib/tomcat8/webapps/websight
/var/lib/tomcat8/webapps/ROOT/META-INF
/var/lib/tomcat8/webapps/ROOT/index.html
/var/lib/tomcat8/webapps/ROOT/META-INF/context.xml
jakub@maredadebianvirtualbox:~$ locate -r "^/var/lib/tomcat[0-9]{1,2}/.*" -l 10
XXXXX@debianvirtualbox:~$
I am trying to list first ten (-l 10) entries matching tomcat installation directory. If I just use [0-9] it properly matches tomcat8, however if I add a quantifier [0-9]{1,2} it matches nothing. Same goes for quantifiers + and ?, however * seems to work fine and so does this expression:
^/var/lib/tomcat[0-9][0-9]*/.*
Why this happens and what's a good workaround?