I am trying to register a custom endpoint, which will accept diacritic (accent) characters, so that I may search it in french.
This is what I have tried:
register_rest_route('events/v1', 'organizations/(?P<search>[a-zA-ZÀ-ž][\wÀ-ÿ]+)' array(
'methods' => WP_REST_Server::READABLE,
'callback' => 'get_event_organizations',
'args' => [
'search',
],
));)
The regex should work : https://regex101.com/r/aM6tV1/41
But the endpoint returns a rest_no_route / 404
EDIT
Thanks @Tim I was overcomplicating it!
register_rest_route('events/v1', 'organizations/(?P<search>[\w].+)' array(
'methods' => WP_REST_Server::READABLE,
'callback' => 'get_event_organizations',
'args' => [
'search',
],
));)