regex issue

Edho Arief edho at myconan.net
Thu Jan 19 07:17:10 UTC 2012


On Wed, Jan 18, 2012 at 11:58 PM, mpratt <m.pratt1 at verizon.net> wrote:
> For some reason, I am unable to take a URI like
> example.com/manufacturers/metlox/0?page=13 and change it to
> example.com/manufacturers/m
>
> It seems like the curly braces aren’t working. I’ve tried the following
> without results:
>



/(.{1})/
This will match and capture one character between slashes
Examples:
/a/ -> $1: a
/asd/ -> no match (three characters)

/([a-z]*)/
This one will match and capture one or less letter between slashes
Examples:
/a/ -> $1: a
/asd/ -> no match

/([a-z]?)/
This one is equivalent to /([a-z]*)/

/([a-z] ?)/
This one will match and capture one letter followed by space between slashes
Examples:
/a/ -> no match
/a / -> $1: " a"
/asd/ -> no match

/(.).*/
This one will match one or more characters between slashes and capture
the first character
/a/ -> $1: a
/a / -> $1: a
/asd/ -> $1: a


-- 
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



More information about the nginx mailing list