Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regular Expression. Digit to space replacement.

sergey_tuzov
Explorer
0 Likes
587

Dear experts.

Would anybody be able help me to write regular expression,

which replaces all digits in string by space.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
519

Hi,

Check this code..

DATA : L_CHAR TYPE CHAR40 VALUE 'AVINASH 121 Name3ewr kjh23ohjo'.
WRITE :/ l_CHAR.
REPLACE ALL OCCURRENCES OF REGEX '1.|2.|3.|4.|5.|6.|7.|8.|9.|0' IN L_CHaR WITH space.
WRITE :/ l_CHAR.

2 REPLIES 2
Read only

Former Member
0 Likes
520

Hi,

Check this code..

DATA : L_CHAR TYPE CHAR40 VALUE 'AVINASH 121 Name3ewr kjh23ohjo'.
WRITE :/ l_CHAR.
REPLACE ALL OCCURRENCES OF REGEX '1.|2.|3.|4.|5.|6.|7.|8.|9.|0' IN L_CHaR WITH space.
WRITE :/ l_CHAR.

Read only

Former Member
0 Likes
519

even you can try the followign code

DATA: STR Type String value 'abc1234',

num_space(20) VALUE '1 2 3 4 5 6 7 8 9 0 '.

TRANSLATE STR USING num_space.