php - How to make a right route? -


for example have url & route:

http://mysite/test/article-1 

and

// route on test     route::set('test', 'test/<alias>',array('alias'=>'\d+')) 

it work http://mysite/test/article, how make right? , rule alias can't starts digit.

this regex might looking for.

^(?![0-9])([a-za-z0-9]+)(-([0-9]+))?

some tests:

  • article -> true
  • article-19 -> true
  • article-article-19 -> true
  • article19 -> true
  • why-are_programmers+developers_on_stack-overflow -> true
  • 1article -> false
  • 1article-17 -> false

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -