|
Carrot and dollar are beginning of string/end of string anchors. So the _expression_ "^/search?q=$" will only match if there is no text preceding or following "/search?q=".
If you want to allow text to match following the _expression_, then remove the dollar anchor: "^/search?q=". Then it can match strings like "/search?q=my
querystring".
-Will
From: <Dunlap>, Zachariah <[email protected]>
Reply-To: MarkLogic Discussion <[email protected]> Date: Tuesday, July 30, 2013 11:29 AM To: MarkLogic Discussion <[email protected]> Subject: [MarkLogic Dev General] fn:replace in QConsole I’m trying to test using fn:replace in QConsole and I’m hitting a small snag but can’t figure out where I’m going wrong. When I run this query in QConsole: xquery version "1.0-ml"; let $url := "/search?q=test" return fn:replace($url, "^/search?q=$", "/v1/search?options=appl&q=") I get back the string in $url and not the replacement, I can’t tell what I’m doing wrong. I’m using this query in the url rewrite section of one of our app servers and it works great: xquery version "1.0-ml"; let $url := xdmp:get-request-url() return fn:replace($url, "^/search$", "/login.xqy" This leaves me a bit stumped. Any help would be greatly appreciated. Thanks, Zach The information contained in this communication is intended for the use msk dccc60c6d2c3a6438f0cf467d9a4938 |
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
