And now for the feedback … regex is not an appropriate default for this addition as it is an expert only concept for something that needs to be easy for the default case.
Euh… I disagree with this concept of “expert only”, based on experience. And mind, I’m not in love with regexes, always tells people “ha, you wanted to
solve a problem with regular expressions, now you have two problems!”. But as said, day to day experience setting up GS systems tells me otherwise:
- SQL View params validation are based on regular expressions (and they are security related, too!).
We made an effort to have a generic validation interface so that we could implement simpler validators later. It just never happened.
- GWC parameter filters allow for a variety of filter types, including list of numbers and strings. In practice, what do we use the most? Guess what, regexes, the others are just too rigid to work against viewparams, env, time and elevation. We could have a range based validator, or one that picks from the available times and elevations in the data source, it would be at the same time more robust and easier to configure… but it’s not there, nobody bothered to implement one.
Are regular expressions actually that hard? It depends… a simple yet robust prefix match regular expression looks like “^prefix.*$”.
Leaning to build basic regexes can be done in less than a hour going through the tutorials at https://regexone.com/
Making sure that a regex does what you meant is not hard either, go to https://regex101.com/ and it will explain to you, e.g.: https://regex101.com/r/5PJIKS/1
Doing advanced regular expressions, e.g. negative or positive lookaheads, is indeed hard, but if one really needs to get there, it means there is no simple substitute for it, or that it’s possible to write code to build a simpler substitute that will work for that specific case only (e…g, range of dates).
If the description of what you need to match is clear, the ChatGPT can build the regex for you, too, e.g.:
A complex regex for sure, but apparently, a legit one, you can play with it here:
https://regex101.com/r/dp4k0l/1
Some ideas I would find okay:
- Adding the default for regex type:
The field default prompt:(http://localhost:8080/geoserver/ows\?(.*)$)
This would be easy to understand and adapt for users.
Works for me, will do it this way, and point to the tools above from the documentation, for those that want to learn.
I’ll also make sure the XML configuration file does not limit implementations to regexes by having a tag
as the matcher container, so that a one can be added later.
Cheers
Andrea
···
GeoServer Professional Services from the experts!
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions Group
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
https://www.geosolutionsgroup.com/
http://twitter.com/geosolutions_it
Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail