Nginx cookie map regex remove + character

Francis Daly francis at
Mon Apr 3 22:37:20 UTC 2017

On Mon, Apr 03, 2017 at 10:12:04AM +0200, B.R. via nginx wrote:
> On Sat, Apr 1, 2017 at 1:57 PM, Francis Daly <francis at> wrote:
> > If you want to match "word character or plus", use something like [\w+].
> >
> ​Defining a pattern over a simple assertion is kinda strange​. '[' & ']'
> are useless here, since you are not matching several symbols.

I think we may be reading the original question differently.

I read it that the current regex matches one or more letter-or-number, and
what is wanted is something to match one or more letter-or-number-or-plus.

> Use (?<session_value>\w+) and you should be all set.
> Btw, if you were to use '+', [\w+] and [\w]+ have different meaning: first
> quantifier applies to '\w' only while latter applies to all the symbols in
> the pattern.

The first + is not a quantifier. At least, in the regex engine I use.

Francis Daly        francis at

More information about the nginx mailing list