I have a web service that I have a rewrite on. I need to be able to allow hyphens or dash in the query.
Here is my rewrite:
rewrite ^/app/api/sanction/([0-9]+)/athleteList/([a-zA-Z0-9,]+)/-([0-9,]+)$ /app/athleteList.phtml?s=$1&l=$2&c=$3 last;
The query works fine like this:
/app/api/sanction/35172/athleteList/MLEVEL07/25001,24450
However when I put a dash or hyphen here, the query will fail.
/app/api/sanction/35172/athleteList/MLEVEL-07/25001,24450
As you can see, I have the hyphen listed in the regex, unsure of what I may be doing wrong here…
You should place the hyphen in the previous group :
This will, however, match “—1020-,-02-1-,” and i’m not sure this is what you want. Hence my first proposition, corrected now:
This will match only “weofhw234fhweo,sdfsff3284982-20423400” and not “–,j2j,f9223-2-3402–0d-f0s-f”