I guess it makes sense somehow, adding extra braces around the (...)+ part solved my problem..
Cheers, Geert -----Oorspronkelijk bericht----- Van: Geert Josten [mailto:[email protected]] Verzonden: maandag 30 januari 2012 7:45 Aan: General MarkLogic Developer Discussion Onderwerp: RE: [MarkLogic Dev General] Replace acting weird? Yes, that would, but it is there for a purpose. I am parsing an encoded string, which can contain escaped characters, like \" and \n. So, the first piece matches anything except \ and ", following parts matches all allowed escaped characters. That continues till it hits a " without a \ in front of it.. Looking at the pattern, I see no reason at all why the replace would return only 3A (the last two characters in front of the final ") instead of the entire string.. Kind regards, Geert -----Oorspronkelijk bericht----- Van: [email protected] [mailto:[email protected]] Namens Ron Hitchens Verzonden: zondag 29 januari 2012 22:36 Aan: General MarkLogic Developer Discussion Onderwerp: Re: [MarkLogic Dev General] Replace acting weird? I removed the \\ from before the first " and got what you expected but without the enclosing double quotes. Not sure if that's what you're looking for. On Jan 29, 2012, at 8:31 PM, Geert Josten wrote: > Is it me or is this code not returning what it is supposed to? I'm using > Query Console in ML 5.0-2, and it returns just '3A', while I was expecting > all from first " upto the " before $$$$$.. > > let $text := <text><![CDATA["Novotroitsk is een stad in de Russische > oblast Orenburg. De stad ligt in de Zuidelijke Oeral bij de > Goeberlinskiheuvels aan de westeroever van de rivier de Oeral in het > district Orsk-Tsjalilovski op 276 kilometer van Orenburg en ongeveer 30 > kilometer van Orsk bij de grens met Kazachstan. Bij de volkstelling van > 2002 woonden er ongeveer 106.000 mensen. De plaats ontstond uit twee > nederzettingen uit de jaren '20: Novo-troitsk en Akkermanovka. Op 13 april > 1945 werden deze twee nederzettingen bestuurlijk samengevoegd tot de stad > Novotrotsk. Momenteel behoren tot het stedelijk district: Novotroitsk - > 106.315 inwoners; Akkermanovka - 1.271 inwoners; Novoroedny (nederzetting > met stedelijk karakter) - 1.941 inwoners; selsovjet Novonikolski (selo > Novonikolsk, treinstation Goeberlja en spoorvertakking 213 km); selsovjet > Prigornenski; selsovjet Chabarinski. De verwerking van ijzer is een > belangrijke bron van inkomsten voor de stad, evenals diverse > chemiebedrijven. De voetbalclub FC Nosta Novotroitsk speelt in de > Russische Tweede Divisie. Bevolkingsontwikkeling [bewerken] Bronnen, noten > en/of referenties Bronnen, noten en/of referenties: (ru) Encyclopedie Moj > gorod: > \u041D\u043E\u0432\u043E\u0442\u0440\u043E\u0438\u0446\u043A"$$$$$blabla]] >> </text> > let $pattern := > <pattern>^"([^\\"]+|\\[\\"nrt]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})+"(.*)< > /pattern> > return replace($text, $pattern, '$1') > > > Grtz > > drs. G.P.H. (Geert) Josten > Senior Developer > > > > Dayon B.V. > Delftechpark 37b > 2628 XJ Delft > > T +31 (0)88 26 82 570 > > [email protected] > www.dayon.nl > > De informatie - verzonden in of met dit e-mailbericht - is afkomstig van > Dayon BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit > bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan > dit bericht kunnen geen rechten worden ontleend. > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general --- Ron Hitchens {mailto:[email protected]} Ronsoft Technologies +44 7879 358 212 (voice) http://www.ronsoft.com +1 707 924 3878 (fax) Bit Twiddling At Its Finest "No amount of belief establishes any fact." -Unknown _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
