0

i have created a route in laravel

$stagechapter="[1-8]-.*";
$stagestage="[0-9]-.*";

Route::get('/{lang}/{chapter?}/{stage?}', 'StageController@Listing')->where('lang', $langs)->where("chapter",$stagechapter)->where("stage",$stagestage);

I want any character after the - until next /, the problem is that $chapter is capturing both directories,... So, when i write

/en/1-chapter1/1-stage1 in browser i get $lang="en", $chapter="1-chapter1/1-stage1" and $stage NULL.

I understand that .* expresion gets anything until the end so ...so, whats the right regular expresion to stop at / and get $chapter="1-chapter1" and $stage="1-stage1"?

I get

Hamboy75
  • 938
  • 1
  • 11
  • 22

0 Answers0