created on 01.05.2016 at 23:38

A blog post by

Gerrit Böselager

ABAP: Remove special characters from text


24033 views


With the following ABAP code, various special characters can be removed from a string using a regular expression. This example shows removing all Unicode characters from the lv_string variable.

"remove all unicode characters from lv_string
replace all occurrences of regex '[[:unicode:]]' in lv_string with ''.


Here are more regular expressions for specific character groups:

[[:alnum:]]Alphanumeric characters
[[:alpha:]]Letters
[[:blank:]] Spaces and horizontal tabs
[[:cntrl:]] Control character
[[:digit:]]Digits
[[:graph:]]Graphic special characters
[[:lower:]]Lowercase
[[:print:]]Displayable characters
[[:punct:]]Punctuation marks
[[:space:]]Spaces, tabs and feeds
[[:unicode:]]Unicode character (code greater than 255)
[[:upper:]]Capital letters
[[:word:]]Alphanumeric characters and _ (underscore)
[[:xdigit:]]Hexadecimal digits

Source: help.sap.com - Regex

  tags for this post

Regulärer Ausdruck
 
Regex
 
Sonderzeichen
 
ABAP
 

  ranking

How relevant is this post for you?