Expand regex example in Readme
This commit is contained in:
parent
cef8c93756
commit
743e3e2ee9
|
@ -203,7 +203,7 @@ end
|
|||
Routen mit regulären Ausdrücken sind auch möglich:
|
||||
|
||||
```ruby
|
||||
get %r{/hallo/([\w]+)} do
|
||||
get /^\/hallo\/([\w]+)$/ do
|
||||
"Hallo, #{params['captures'].first}!"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -117,7 +117,7 @@ end
|
|||
Rutas con Expresiones Regulares:
|
||||
|
||||
``` ruby
|
||||
get %r{/hola/([\w]+)} do
|
||||
get /^\/hola\/([\w]+)$/ do
|
||||
"Hola, #{params['captures'].first}!"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -207,7 +207,7 @@ end
|
|||
Une route peut aussi être définie par une expression régulière :
|
||||
|
||||
``` ruby
|
||||
get %r{/bonjour/([\w]+)} do
|
||||
get /^\/bonjour\/([\w]+)$/ do
|
||||
"Bonjour, #{params['captures'].first} !"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -88,7 +88,7 @@ Az útvonalmintákban szerepelhetnek joker paraméterek is, melyeket a
|
|||
Reguláris kifejezéseket is felvehetünk az útvonalba:
|
||||
|
||||
```ruby
|
||||
get %r{/hello/([\w]+)} do
|
||||
get /^\/hello\/([\w]+)$/ do
|
||||
"Helló, #{params[:captures].first}!"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -207,7 +207,7 @@ end
|
|||
ルーティングを正規表現にマッチさせることもできます。
|
||||
|
||||
``` ruby
|
||||
get %r{/hello/([\w]+)} do
|
||||
get /^\/hello\/([\w]+)$/ do
|
||||
"Hello, #{params['captures'].first}!"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -205,7 +205,7 @@ end
|
|||
라우터는 정규표현식으로 매치할 수 있습니다.
|
||||
|
||||
``` ruby
|
||||
get %r{/hello/([\w]+)} do
|
||||
get /^\/hello\/([\w]+)$/ do
|
||||
"Hello, #{params[:captures].first}!"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -207,7 +207,7 @@ end
|
|||
Route matching with Regular Expressions:
|
||||
|
||||
``` ruby
|
||||
get %r{/hello/([\w]+)} do
|
||||
get /^\/hello\/([\w]+)$/ do
|
||||
"Hello, #{params['captures'].first}!"
|
||||
end
|
||||
```
|
||||
|
@ -216,6 +216,7 @@ Or with a block parameter:
|
|||
|
||||
``` ruby
|
||||
get %r{/hello/([\w]+)} do |c|
|
||||
# Matches "GET /meta/hello/world", "GET /hello/world/1234" etc.
|
||||
"Hello, #{c}!"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -119,7 +119,7 @@ end
|
|||
Rotas podem casar com expressões regulares:
|
||||
|
||||
``` ruby
|
||||
get %r{/ola/([\w]+)} do
|
||||
get /^\/ola\/([\w]+)$/ do
|
||||
"Olá, #{params['captures'].first}!"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -88,7 +88,7 @@ end
|
|||
Rotas correspondem-se com expressões regulares:
|
||||
|
||||
``` ruby
|
||||
get %r{/ola/([\w]+)} do
|
||||
get /^\/ola\/([\w]+)$/ do
|
||||
"Olá, #{params['captures'].first}!"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -121,7 +121,7 @@ end
|
|||
Регулярные выражения в качестве шаблонов маршрутов:
|
||||
|
||||
```ruby
|
||||
get %r{/hello/([\w]+)} do
|
||||
get /^\/hello\/([\w]+)$/ do
|
||||
"Hello, #{params[:captures].first}!"
|
||||
end
|
||||
```
|
||||
|
|
|
@ -108,7 +108,7 @@ end
|
|||
通过正则表达式匹配的路由:
|
||||
|
||||
~~~~ ruby
|
||||
get %r{/hello/([\w]+)} do
|
||||
get /^\/hello\/([\w]+)$/ do
|
||||
"Hello, #{params[:captures].first}!"
|
||||
end
|
||||
~~~~
|
||||
|
|
Loading…
Reference in New Issue