‎2010 Dec 13 6:56 AM
Hi all:
there is an error in the following statement , the error messge while activating the system says
The regular expression '|' is invalid character at position 1., could u pls tell me how exactly correct the following statements.
REPLACE ALL OCCURRENCES of REGEX '|' in s_name1 with ''.
REPLACE ALL OCCURRENCES of REGEX '?' in s_name1 with ''.
REPLACE ALL OCCURRENCES of REGEX '*' in s_name1 with ''.
Thank u vrey much for any reply
‎2010 Dec 13 7:12 AM
Hi,
Please look for F1 on REGEX. The character which needs to be replaced should be at position 1.
DATA : text TYPE string VALUE 'aa-'.
REPLACE ALL OCCURRENCES OF REGEX 'a*' IN text WITH 'y'.
Regards,
Srini.
‎2010 Dec 13 7:12 AM
Hi,
Please look for F1 on REGEX. The character which needs to be replaced should be at position 1.
DATA : text TYPE string VALUE 'aa-'.
REPLACE ALL OCCURRENCES OF REGEX 'a*' IN text WITH 'y'.
Regards,
Srini.
‎2010 Dec 13 7:53 AM
|, * and ? are all 'special' characters in regular expressions. I believe you want to replace exactly those literals in your text and not to use them as meta-characters. If this is so, then just try to escape them. Probably prefixing your chars with backslash will help: \| \* \?. If not, read the docs for escaping.
‎2010 Dec 13 11:35 AM
You probably don't need the REGEX option at all for that simple replace that you are trying to do. Read the F1 help for REPLACE carefully.
Thomas
‎2010 Dec 13 11:44 AM
hi ,
I agree with thomas , u dont have to specify REGEX ...
For Ex :
data : g_str2(100) type c value '12:30:40'.
REPLACE ALL OCCURRENCES OF ':' IN G_STR2 WITH SPACE.
Result : g_str2 = 12 30 40.
All occurances of g_str2 will be replaced by space.
Cheers !
Soumya Ranjan