emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-bug-tracker] bug#5812: marked as done (expr: Difference in behavi


From: GNU bug Tracking System
Subject: [Emacs-bug-tracker] bug#5812: marked as done (expr: Difference in behavior of match and :)
Date: Mon, 05 Apr 2010 04:43:02 +0000

Your message dated Sun, 4 Apr 2010 22:42:13 -0600
with message-id <address@hidden>
and subject line Re: bug#5812: expr: Difference in behavior of match and :
has caused the GNU bug report #5812,
regarding expr: Difference in behavior of match and :
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact address@hidden
immediately.)


-- 
5812: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5812
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: expr: Difference in behavior of match and : Date: Wed, 31 Mar 2010 18:35:16 +0530


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


--- End Message ---
--- Begin Message --- Subject: Re: bug#5812: expr: Difference in behavior of match and : Date: Sun, 4 Apr 2010 22:42:13 -0600 User-agent: Mutt/1.5.18 (2008-05-17)
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


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]