ruby on rails - Sinatra route regex constraints? -


i rebuild small rails (too overkill) app in sinatra. have route this:

match 'verify/:name/:bundle/:license' => 'verify#index', :constraints => { :bundle => /.*/ } 

how can rebould in sinatra in terms of constraints attribute?

thanks!

you can either way: (taken sinatra's documentation)

get %r{/hello/([\w]+)}   "hello, #{params[:captures].first}!" end 

or inside block itself:

get '/hello/:name'   raise sinatra::notfound unless params[:name].match /\w+/   "hello, #{params[:name]}!" end 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -