BaseX-Talk Digest, Vol 110, Issue 29
Saturday, 23 February 2019 · 2 messages · last reply 25 Feb 2019
SF
Shaun Flynn23 Feb 2019 22:11 #
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
Quoted text · 69 lines
On Sat, 23 Feb 2019, 11:00 , <basex-talk-request at mailman.uni-konstanz.de> wrote: > Send BaseX-Talk mailing list submissions to > basex-talk at 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 at mailman.uni-konstanz.de > > You can reach the person managing the list at > basex-talk-owner at 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 at gmail.com> > To: BaseX <basex-talk at mailman.uni-konstanz.de> > Subject: [basex-talk] RESTXQ and regexp > Message-ID: <3f71e0bc-e16d-6c4d-6ee8-246a7cc7595c at 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 > ******************************************* >
ML
Marco Lettere25 Feb 2019 13:06 #
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.
Quoted text · Shaun Flynn · 100 lines
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 at mailman.uni-konstanz.de > <mailto:basex-talk-request at mailman.uni-konstanz.de>> wrote: > > Send BaseX-Talk mailing list submissions to > basex-talk at mailman.uni-konstanz.de > <mailto:basex-talk at 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 at mailman.uni-konstanz.de > <mailto:basex-talk-request at mailman.uni-konstanz.de> > > You can reach the person managing the list at > basex-talk-owner at mailman.uni-konstanz.de > <mailto:basex-talk-owner at 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 at gmail.com <mailto:m.lettere at gmail.com>> > To: BaseX <basex-talk at mailman.uni-konstanz.de > <mailto:basex-talk at mailman.uni-konstanz.de>> > Subject: [basex-talk] RESTXQ and regexp > Message-ID: <3f71e0bc-e16d-6c4d-6ee8-246a7cc7595c at gmail.com > <mailto:3f71e0bc-e16d-6c4d-6ee8-246a7cc7595c at 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 > ******************************************* >
Written for BaseX 9.1. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery