Answer the question
In order to leave comments, you need to log in
The regular expression does not see the "-" character. How to decide?
There are url patterns, but regular expressions don't see the "-" sign.
Here is the code for the regular expression:
$to_match = preg_replace('/{([a-z]+):([^\}]+)}/', '(?P<\1>\2)', $to_match);
$to_match = '#^'.$to_match.'$#';
item/{name:\w+}
. If you go to the address item/item_name
, then everything is fine. But if you go to item/item-name
, it no longer finds matches.
Answer the question
In order to leave comments, you need to log in
Before sending the template, try to escape special characters in it, incl. hyphen. So instead, item/item-name
pass it like this:item\/item\-name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question