mc_fish
mc_fish

Reputation: 503

Kohana 3.2 route not matching

this is the route that makes problems:

Route::set('api', 'api(/<action>(/<currency_data>(/<currency_value>)))',
    array(
        'currency_data' => '(\d\-\d)|(\w\-\w)',
        'currency_value' => '\d+(\.\d{1,2})?'
    ))
    ->defaults(array(
        'controller' => 'api',
        'action'     => 'get',
    ));

the url would be something like:

/api/currency/123-321/123.00

or

/api/currency/abc-cba/123

both scenarios are covered but at the end do not work, why? the default rout is at the end of bootstrap(i know someone will suggest that)

tnx

Upvotes: 0

Views: 177

Answers (2)

mc_fish
mc_fish

Reputation: 503

Im an idiot and sry if any of you tried to solve my problem...

i commented the second regex and that the obvious reason why it did not work...tnx everyone

Upvotes: 0

Darsstar
Darsstar

Reputation: 1895

\d and \w only match one character. Therefore 123-321 does not match \d-\d and abc-cba does not match \w-\w.

If this is not the problem then please give more information on how it "does not work". What does work? What is the result you get, etc.

Upvotes: 1

Related Questions