I found a script which has the following snippet:-
userid=`expr "\`id\`" : ".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"`
It returns the userid.
When i tried to learn how it is doing:-
#id
#uid=11008(adilm) gid=1200(cvs),1400(build)
So I realized that (.[0-9a-z]*) is matching the userid. But if I placed like below:
#userid=`expr "uid=11008(ADILM) gid=1200(cvs),1400(build)" : ".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"`
#echo $userid
ADILM
It works. As per my understanding '.' is matching to ADILM. But when i removed '.' like below:-
#userid=`expr "uid=11008(ADILM) gid=1200(cvs),1400(build)" : ".*uid=[0-9]*(\([0-9a-z]*\)) .*"`
#echo $userid
ADILM
It still works how? We have only provided lowercase letters but its still working.