Monday, March 21, 2011

Reminder: Zend Framework Route Regex

If you want to make the route / optional
'archive(?:/(\d+))?' 

A note about the above regular expression. It uses one of the "expression syntax" which uses ?:
This means that every digit inside (?:) will NOT be group and outputted separately.

Consider this:

$t = 'archive/1234';
preg_match('#archive(?:/(\d+))?#', $t, $matches);
//outputs
array(
[0] => archive/1234
    [1] => 1234
)


Whereas without ?:

$t = 'archive/1234';
preg_match('#archive(/(\d+))?#', $t, $matches);
//outputs
Array
(
    [0] => archive/1234
    [1] => /1234
    [2] => 1234
) 
 
notice that if you include ?: that the "/1234" did not get outputted.

7 comments:

Unknown said...

Sergei , October 22, 1970 Born in Christian Louboutin Bois Dore Moscow State Ozherelye. Perhaps influenced by Cheap LV Handbags their parents worship warrior army, join the army in cheap jordans 1989, and into the elite airborne military service. 1991, by the influence of the Soviet Union, the uggs on sale Russian christian louboutin army general lack of funds, a large number ugg australia of Air Jordan 11 Gamma Blue soldiers seeking veterans, but under extremely difficult conditions still dedicated, praise superiors, and soon was sent to the famous christian louboutin shoes Ryazan Higher ugg Airborne Command School studies. After graduating in 1994, entered the famous Pskov 76th Guards Airborne discount christian louboutin Division, served as discount nike jordans the reconnaissance platoon, reconnaissance ugg soldes deputy company commander, company commander, battalion airborne regiment scouting director and other duties.From 2000 to Cheap Louis Vuitton Handbags 2004, where the forces have repeatedly ordered war with Chechen militants. Because of their opponents in order to form the squad activity and haunted impermanence, the Russians had to ugg boots mobilize elite troops set up large uggs outlet number of small units, "a Discount Louis Vuitton small wholesale jordan shoes play small" Implementation siege. commanding troops in Chechnya, Christian Louboutin Daffodile Ingushetia and other places over the mountains, to track the militants fled. Discount LV Handbags Although the militants were extremely vigilant, but as long as the task has never had outsmarted.August 8, 2008, Georgia suddenly invade South Ossetia (Russian peacekeepers stationed ugg pas cher there), the Russian military to respond quickly, including including the 76th Guards Airborne Division, more than christian louboutin remise 50% 3,000 people were immediately delivered to the pro-Russian Abkhazia, Georgia cheap nike jordan shoes Army contain two infantry brigades, effectively coordinate the cheap christian louboutin direction of the Russian Bags Louis Vuitton troops in South Ossetia.

Unknown said...

kate spade handbags
lebron 12
nike air max
prada shoes
los angeles clippers jerseys
nike shoes
nba jerseys wholesale
nike air max,air max uk,air max 90,nike air max 90,air max shoes
arthur jones jersey,deonte thompson jersey,courtney upshaw jersey,timmy jernigan jersey,jeromy miles jersey,haloti ngata jersey,joe flacco jersey,steve smith sr jersey
dallas cowboys jersey
cartier love bracelet
north face jackets
atlanta falcons jersey
the north face jackets
air max 90
new orleans saints jerseys
uggs on sale
gucci outlet online
green bay packers jerseys
peter konz jersey,paul worrilow jersey,prince shembo jersey
michael kors handbags
49ers jersey
evening dresses outlet
the north face outlet store
lebron shoes
nike sneakers
nike air max
mbt shoes outlet
north face jackets
nike free run
zhuweiming0627

chenlina said...

chenlina20160127
canada goose jackets
cheap ugg boots
ugg boots
christian louboutin outlet
cheap toms
coach outlet
oakley sunglasses
ugg boots
toms outlet
abercrombie and fitch new york
vans shoes sale
louis vuitton outlet
coach factory outlet
ray ban sunglasses
longchamp outlet
fitflops sale clearance
coach factory outlet
michael kors bag
hollister
fake oakley sunglasses
tod's shoes
cheap jerseys
louis vuitton
gucci outlet
tory burch outlet
cheap air jordans
ugg boots
supra shoes
louis vuitton
oakley vault
cheap nfl jerseys
louis vuitton outlet
nike trainers uk
michael kors handbags
lebron 11
louis vuitton outlet
cheap oakley sunglasses
uggs outlet
ugg sale
polo outlet
as

Unknown said...

michael kors handbags wholesale
rolex replica watches
michael kors handbags
basketball shoes
hugo boss
cheap oakley sunglasses
boston celtics
cheap jordans
converse trainers
ferragamo shoes

Unknown said...

Our Detroit Lions Banner Flag measures 28x40 inches, is constructed of 2-ply 100% polyester, and provides a top sleeve for hanging vertically from a wood flagpole. The Detroit Lions Banner Flag is high quality dye sublimated with the NFL Lions logo as shown. NFL Banners Flags are a perfect way to show neighbors your NFL team allegiance by flying from your front porch, patio, or deck.
nfl house flags
nfl flags wholesaleBills stars and stripes flags
Dallas Cowboys house flags

caiyan said...

tommy hilfiger outlet
hollister clothing store
michael kors handbags outlet
ralph lauren outlet
jerseys cheap
fitflops clearance
adidas sneakers
christian louboutin outlet
polo ralph lauren
birkenstock shoes
0413shizhong

amc stars said...

خرید بلیط هواپیما بلیط هواپیما