Hi, it's probably easier if you declare the character groups you want to keep and excluding everything else, like so:
let $string := "AB cd/EF;gh" return replace($string, '[^a-zA-Z]+', '') (: everything that's not an alphabetical character will be replaced :) ==> "ABcdEFgh" cheers, Jakob. On Thu, May 10, 2012 at 4:00 PM, Rajasekaran, Santhosh <[email protected]> wrote: > Hi Folks, > > > > I have the below requirement in Xquery. > > > > Given a string I need to remove spaces, punctuation, parens and etc., > (I.e)except alpha(A-Z or a-z) and numeric 0-9 > > > > Eg: > > > > Input Expected Output > > > > San & co., Sanco > > It is a string Itisastring > > New (value) Newvalue > > At,the hill + school Atthehillschool > > Oh!.. is it, I don’t know OhisitIdontknow > > > > Please let me know how do I achieve this. Do I need to add all this > characters (spaces,punctuation,parens and etc., in regular expression and > replace that one by one) using fn:replace() function. > > Or > > Do we have any other better suggestion? > > > > Thanks & Regards, > > Santhosh > > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
