bug-bash
[Top][All Lists]
Advanced

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

[^/]+ vs. [^/]* - Regular Expression bug?


From: Morten Lauritsen Khodabocus
Subject: [^/]+ vs. [^/]* - Regular Expression bug?
Date: Tue, 09 Feb 2010 06:38:38 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hello,

Ran into some particular behaviour with REs in bash, I just cannot understand how this could possibly be correct behaviour. Then again, I am no bash guru, could very well be me missing a clue.

If I am wasting your time, sincere apologies.

I am not subscribed to the list, so please include my email explicitly in any replies that you would like me to read / respond to.

Thanks a million for a great shell! Beers are on me next time any of you are in Zurich.

Here's the bashbug description:

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib -g -O2 -Wall uname output: Linux sony2 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 01:26:53 UTC 2010 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 4.0
Patch Level: 33
Release Status: release

Description:
Two regular expressions should match the same thing, but for some reason do not:
[[ '/home/' =~ [^/]+ ]]; echo address@hidden
and
[[ '/home/' =~ [^/]* ]]; echo address@hidden
the first matches 'home', the second matches nothing. The only difference is * vs. + AFAICT, both expressions should match 'home'.

Repeat-By:
Simply evaluate the two lines from the description.


Thanks again,
Morten





reply via email to

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