GNU bug report logs -
#5812
expr: Difference in behavior of match and :
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
This is an automatic notification regarding your bug report
which was filed against the coreutils package:
#5812: expr: Difference in behavior of match and :
It has been closed by Bob Proulx <bob <at> proulx.com>.
Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Bob Proulx <bob <at> proulx.com> by
replying to this email.
--
5812: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5812
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Adil Mujeeb wrote:
> Thanks Bob for such a nice explanation and your instinct is right. It is
> locale problem.
> ...
> And the other point you made is also right. I didn’t realize that I was
> using another session for comparing the result with match which ahs
> different locale:-
I thought it might have been something like that.
> I never knew that locale has effect on the behavior. We can close this bug.
I will close the bug with this message then.
> Thank you so much for your time and details, I have learnt new thing :)
I am glad to have helped!
> Also, thanks for correcting my regex.
Sure thing!
Bob
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
Hello team,
I have tried following snippet in a bash script:
-bash-3.1$userid=`expr "uid=11008(ADILM) gid=1200(cvs),1400(build)" :
".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"`
-bash-3.1$echo $userid
ADILM
-bash-3.1$
To my knowledge it should not able to extract ADILM as the regex does not
include uppercase letters (A-Z).
In the expr man page it is mentioned that:
-----8<----------
match STRING REGEXP
same as STRING : REGEXP
-----8<----------
So i tried following snippet:-
-bash-3.1$ userid=`expr match "uid=11008(ADILM) gid=1200(cvs),1400(build)"
".*uid=[0-9]*(\(.[0-9a-z]*\)) .*"`
-bash-3.1$ echo $userid
-bash-3.1$
I changed the regex and added uppercase letters:-
-bash-3.1$ userid=`expr match "uid=11008(ADILM) gid=1200(cvs),1400(build)"
".*uid=[0-9]*(\(.[0-9A-Za-z]*\)) .*"`
-bash-3.1$ echo $userid
ADILM
-bash-3.1$
So it means that match is not same as ":". As per observation ":" uses
case-insensitive matching while match is strict case sensitive matching.
Can you update the man page OR let me know if i am doing anything wrong?
Package:-
-bash-3.1$ rpm -qf /usr/bin/expr
coreutils-5.97-12.1.el5
-bash-3.1$
Thanks and Regards,
Adil Mujeeb
[Message part 5 (text/html, inline)]
This bug report was last modified 15 years and 110 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.