Hi semerau,

Thanks for your valuble suggestion.

________________________________________
From: [email protected] 
[[email protected]] On Behalf Of [email protected] 
[[email protected]]
Sent: Friday, May 11, 2012 9:50 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Need to Remove spaces, punctuations,       
parens and ect.,        from the given string (need to remove all character 
other than  A-Z     and 0-9)

If you want to convert diacritic chars to non-diacritic you can use 
xdmp:diacritic-less

Sent from my iPhone

On May 11, 2012, at 6:50 AM, "Whitby, Rob, Springer Healthcare UK" 
<[email protected]> wrote:

> I had to do something similar - try this:
>
> let $string := "Peña, replaces dia char"
> return replace($string, '[^\p{L}|\p{N}]+', '')
>
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Rajasekaran, 
> Santhosh
> Sent: 11 May 2012 13:08
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Need to Remove spaces, punctuations, 
> parens and ect., from the given string (need to remove all character other 
> than A-Z and 0-9)
>
> Hi Jakob,
>
> Thanks, Ya it worked well, but it also removes the diacritics character also.
> If i do not want to remove diacritics the what to do?
>
> Eg:  -->
> let $string := "Peña, replaces dia char"
> return replace($string, '[^a-zA-Z]+', '')
> ==> Peareplacesdiachar
>
> I need "Peñareplacesdiachar"
>
> Thanks
> Santhosh
>
>
>
> ________________________________________
> From: [email protected] 
> [[email protected]] On Behalf Of Jakob Fix 
> [[email protected]]
> Sent: Thursday, May 10, 2012 10:22 AM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Need to Remove spaces, punctuations, 
> parens and ect., from the given string (need to remove all character other 
> than A-Z and 0-9)
>
> 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
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to