Finding tags in query string with regular expression

Posted by fatmatto on Stack Overflow See other posts from Stack Overflow or by fatmatto
Published on 2010-03-24T11:10:39Z Indexed on 2010/03/24 11:13 UTC
Read the original article Hit count: 287

Filed under:
|
|

Hi everybody!

I have to set some routing rules in my php application, and they should be in the form /%var/something/else/%another_var

In other words i beed a regex that returns me every URI piece marked by the % character, String marked by % represent var names so they can be almost every string.

another example: from /%lang/module/controller/action/%var_1 i want the regex to extract lang and var_1

i tried something like

/.*%(.*)[\/$]/

but it doesn't work.....

© Stack Overflow or respective owner

Related posts about php

Related posts about regex