Replace Special Characters

Hi folks,

I wish to replace the special characters like !,@,#,$ etc with the desired string. I was trying to utilise the “pub.string:replace” service to replace the special characters but was able to replace just one string but not the case where either of the special chars occur in a string (! or @ or # or $ etc.,)

Really appreciate if someone could shoot the solution that could replace any of the strings with a desired string

Thanks,
AJ

Hello,

Yemi Bedu

Thanks Yemi Bedu. Thats what I was looking for.

Hi,

I’m stuck in a similar situation , when I use pub.string.replace
I need to replace the value in between 2 <get_eco> tags in a string by another value coming from another string, The problem is when I hardcode the search [/<get_eco>(…)<get_eco>] the service looks at teach character individually and makes a mess of the whole string. I just can’t find the right expression to replace any character between these 2 tags.

Thanks in advance, I have also tried word boundaries with no result

Hello,

Yemi Bedu

Monzoon,

what is ur expected output should be and do you want replace <get_eco> to </get_eco>?

HTH,
RMG

Thanks Yemi Bedu,

Except that the Dog value is replacing my whole search string in my string. What I got is the equivalent of <get_eco>dog<get_eco>boydog

I did however solve the problem using another variable -replace1- for example containing the -dog- value, Then I used

<get_eco>%replace1%<get_eco>

as my replaceString value and checked the Perform variable substitution box. and I got:

<get_eco>dog<get_eco>boy<get_eco>dog<get_eco>

Thanks a lot for your help and the references.

Hello,

Yemi Bedu

Hello,
Can any one tell me how can I use pub.string.replace to remove all the special charactors. In staer of giving list of charatctoes to be removed can I give the pattern of characters to allowed something like [0-9] , [a-z], [A-Z], ~,*,^
Since I am dealing with EDI string the resultant string should have the special charactors which are mandetory for an EDI string.
It would be grate if some one can let me know exact sintax for
searchString:
replaceString:
useRegex:true

Thanks in adavance

Why do you need to replace them?
May be you’re having a character set encoding problem.
Can you explain a bit more.

Some special characters are causing problems to when they are sent in EDI.

Can you be more specific about “special characters” and “problems?” What are the characters that are causing a problem? What are the specific problems?

If you’re doing UNEDIFACT, just setting “Escape Character” when doing wm.b2b.edi:convertToString will allow the “special characters” to be handled properly. Not familiar enough with X12 to know if it’s a standard thing to do…

I am using (SAP BC 4.6), an string replace function to convert the input string in to an desired string!.

Eg:

My input string is : “A.Ö.KRANKE$NHAUS D.BARMH.BRÜDER”

an I expect the output like: “A.O.KRANKESNHAUS D.BARMH.BRUDER”

[FONT=Arial]Can anybody help me in this regard

-C@rthik:(

[/FONT]

X12 doesn’t use escape chars. One needs to explicitly remove delimiters that appear in the data.

This is a character set issue. There are threads on the forums and sources on the web that cover conversions.

If I want to replace special characters [®,©,™] one with each html entity how can I do with wild cards

Where my inString is This is registered ®,this is copyright ©,this is trademark ™
what should be the searchString
what should be the replaceString where we have to replace ® = reg,© = copy ,™ = trade

out put should be This is registered reg,this is copyright copy,this is trademark trade

Is it possible with a single string:replace service :?:

Any help is appreciated.

You have to explicit replace service and hard code the chars that you want to replace (each char with one replace) and there is no other way to handle it other than store these spl chars in the DB table and replace with null and this eliminates hardcoding and configurable from the DB using a generic framework service.

HTH,
RMG

I have used a java service which will handle all the special characters.

Thanks,

good try…thanks as long it is working for you!