You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when you set a requirement, you set a pattern which is wrapped in the ParamFetcher which results in some frustration when you need to use complex or localized regex.
Here is an use case:
I've the following QueryParam:
@QueryParam(name="q", requirements="[\p{L}]+", description="Keyword to search for")
The \p escape sequence is used to match unicode characters, the {L} means letter only.
Using this pattern I should be able to match any of the following string:
héllo
âbçàœñ
русский
But it is currently not possible because there are no u flag (pattern modifier).
So, the question is open.
I can think of several solutions:
Add the /u flag to the ParamFetcher (may breaks things because an unicode character is several bytes)
Remove the auto-magic pattern wrapper and let the user defines the full pattern (can break things)
Add an option, like "unicode=true" (only fill the unicode problem) or "flags=ugi"
Any thoughts on this?
The text was updated successfully, but these errors were encountered:
I think the main advantage of the unicode/flags approach over the full pattern is that it doesn't break things, but a full pattern is obviously the most flexible. We may do some wrapping magic but it may be tricky.
I am ambivalent because the symfony routing requirements only seem to have the "s" flag set and that's all you get. Here we have "xs" set, which seems kinda wrong. I think I'd be for either having "s" or requiring a full pattern always. Then again "us" seems fine too.
Auto-magic might work though, but indeed it's a dangerous path.
Currently, when you set a requirement, you set a pattern which is wrapped in the
ParamFetcher
which results in some frustration when you need to use complex or localized regex.Here is an use case:
I've the following
QueryParam
:The
\p
escape sequence is used to match unicode characters, the{L}
means letter only.Using this pattern I should be able to match any of the following string:
But it is currently not possible because there are no
u
flag (pattern modifier).So, the question is open.
I can think of several solutions:
/u
flag to theParamFetcher
(may breaks things because an unicode character is several bytes)Any thoughts on this?
The text was updated successfully, but these errors were encountered: