[mapserver-users] [Feature Request] Ability to extract capture group contents from regex validation

Sommer, Ashley (L&W, Dutton Park) Ashley.Sommer at csiro.au
Mon Jul 26 23:12:44 PDT 2021


Hi All,
This is slightly related to my previous thread today, but more general.

I want to gauge interested in this idea.
I want to be able to use Runtime Substitution mechanisms to do something like this:

MAP
  ...
  VALIDATION
    "datetime" "^([0-9]{4})[-_]([0-9]{2})[-_]([0-9]{2})$" # <- 3 capture groups
  END

  LAYER
    DATA "/mnt/dataset/%datetime_1%/%datetime_2%/%datetime_3%.tif"
    ...
  END
  ...
END

Where the query with &datetime=2018-01-29 is split into parts using capture groups 1, 2, and 3 from the validation regex, and stored as new runtime substitution variables: %datetime_1%, %datetime_2%, and %datetime_3%.
Then using these values, substitute them into the DATA string (or any other valid substitution point).
Substituted:
DATA "/mnt/dataset/2018/01/29.tif"

The regex mechanism to validate the incoming parameter value is already in place, and it seems like just one more little step is needed to save the captured groups into new runtime substitution variables.

- Ashley Sommer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20210727/0398a7ac/attachment.htm>


More information about the MapServer-users mailing list