Hi Shaun, I agree on your suggestions related to the regexp. The thing is we _have_ tried to achieve a more fine grained filter by matching in the $path related segment app/"anything but the word input"/input. Unfortunately according to my knowledge this requires fiddling with positive lookahead expressions. We haven't been able to make them work in RESTXQ. We hoped that being /app/"anything"/input/ more specific than /app/"anything"/, the former would ha been preferred. But it doesn't seem to work like that. Regards, Marco.
On 23/02/19 22:11, Shaun Flynn wrote:
Hello there Marco,
This might be down to the choice of regex.
Assume $path = "path"
app/{$path=.+}
Will match
"app/path=1234"
And
"app/path=1234/input"
Which I think would be matched by ".+" part of the expression, as "/input" would match ".+".
Kind regards
On Sat, 23 Feb 2019, 11:00 , <basex-talk-request@mailman.uni-konstanz.de mailto:basex-talk-request@mailman.uni-konstanz.de> wrote:
Send BaseX-Talk mailing list submissions to basex-talk@mailman.uni-konstanz.de <mailto:basex-talk@mailman.uni-konstanz.de> To subscribe or unsubscribe via the World Wide Web, visit https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk or, via email, send a message with subject or body 'help' to basex-talk-request@mailman.uni-konstanz.de <mailto:basex-talk-request@mailman.uni-konstanz.de> You can reach the person managing the list at basex-talk-owner@mailman.uni-konstanz.de <mailto:basex-talk-owner@mailman.uni-konstanz.de> When replying, please edit your Subject line so it is more specific than "Re: Contents of BaseX-Talk digest..." Today's Topics: 1. RESTXQ and regexp (Marco Lettere) ---------------------------------------------------------------------- Message: 1 Date: Fri, 22 Feb 2019 12:05:29 +0100 From: Marco Lettere <m.lettere@gmail.com <mailto:m.lettere@gmail.com>> To: BaseX <basex-talk@mailman.uni-konstanz.de <mailto:basex-talk@mailman.uni-konstanz.de>> Subject: [basex-talk] RESTXQ and regexp Message-ID: <3f71e0bc-e16d-6c4d-6ee8-246a7cc7595c@gmail.com <mailto:3f71e0bc-e16d-6c4d-6ee8-246a7cc7595c@gmail.com>> Content-Type: text/plain; charset=utf-8; format=flowed Hello all, according to the docs this should be possible: (: Matches all paths with "app" as first, a number as second, and "order" as third segment :) declare %rest:path("app/{$code=[0-9]+}/order") ? function page:order($full-path) { ... }; (: Matches all other all paths starting with "app/" :) declare %rest:path("app/{$path=.+}") ? function page:others($path) { ... }; And it actually is... We are currently in the very unfortunate situation where we need the following: (: Matches anything followed by /input :) declare %rest:path("app/{$path=.+}/input") ? function page:inputs($path) { ... }; (: Matches all other all paths starting with "app/" :) declare %rest:path("app/{$path=.+}") ? function page:others($path) { ... }; Unfortunately this makes all the calls to be redirected to the page:others function ... is there a motivation behind it or could it be possible to work around that? Thanks, Marco. End of BaseX-Talk Digest, Vol 110, Issue 29 *******************************************