mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 10:01:11 +02:00
33122: typo from 32891 caused incorrect matches for pcre_match -n
This commit is contained in:
parent
b7ba62871e
commit
956829c18e
3 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2014-09-07 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
|
* 33122: Src/Modules/pcre.c, Test/V07pcre.ztst: typo from 32891
|
||||||
|
caused incorrect matches for pcre_match -n
|
||||||
|
|
||||||
2014-09-06 Barton E. Schaefer <schaefer@zsh.org>
|
2014-09-06 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
* 33118: Src/subst.c: record original param unset state when
|
* 33118: Src/subst.c: record original param unset state when
|
||||||
|
|
|
@ -289,7 +289,7 @@ bin_pcre_match(char *nam, char **args, Options ops, UNUSED(int func))
|
||||||
matched_portion = OPT_ARG(ops,c);
|
matched_portion = OPT_ARG(ops,c);
|
||||||
}
|
}
|
||||||
if(OPT_HASARG(ops,c='n')) { /* The offset position to start the search, in bytes. */
|
if(OPT_HASARG(ops,c='n')) { /* The offset position to start the search, in bytes. */
|
||||||
if ((offset_start = getposint(OPT_ARG(ops,c), nam) < 0))
|
if ((offset_start = getposint(OPT_ARG(ops,c), nam)) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* For the entire match, 'Return' the offset byte positions instead of the matched string */
|
/* For the entire match, 'Return' the offset byte positions instead of the matched string */
|
||||||
|
|
|
@ -108,3 +108,12 @@
|
||||||
>1
|
>1
|
||||||
>0 xo→t →t
|
>0 xo→t →t
|
||||||
>0 Xo→t →t
|
>0 Xo→t →t
|
||||||
|
|
||||||
|
string="The following zip codes: 78884 90210 99513"
|
||||||
|
pcre_compile -m "\d{5}"
|
||||||
|
pcre_match -b -- $string && print "$MATCH; ZPCRE_OP: $ZPCRE_OP"
|
||||||
|
pcre_match -b -n $ZPCRE_OP[(w)2] -- $string || print failed
|
||||||
|
print "$MATCH; ZPCRE_OP: $ZPCRE_OP"
|
||||||
|
0:pcre_match -b and pcre_match -n
|
||||||
|
>78884; ZPCRE_OP: 25 30
|
||||||
|
>90210; ZPCRE_OP: 31 36
|
||||||
|
|
Loading…
Reference in a new issue