Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Replace REPLACE with replace() #286

Open
jan-jezek opened this issue Apr 3, 2024 · 1 comment
Open

Feature Request: Replace REPLACE with replace() #286

jan-jezek opened this issue Apr 3, 2024 · 1 comment

Comments

@jan-jezek
Copy link

REPLACE ALL OCCURRENCES OF PCRE '<([^\/>]+)\/>' IN variable WITH '<$1></$1>'.

https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapreplace.htm
could be replaced with:

variable = replace(
    val  = variable
    pcre = `<([^\/>]+)\/>`
    with = `<$1></$1>`
    occ  = 0 ).

https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenreplace_functions.htm

Similarly, I think there can be many new rules based on "old" and "new" string syntax.
https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenstring_functions.htm

@jmgrassau
Copy link
Member

Hi Jan,

thanks for the idea! We'd have to take a close look on exactly which cases of REPLACE could be replaced with replace() :-), but the hint in the documentation on REPLACE sounds encouraging:

"To replace parts of a character string in an operand position, a replace function can be used that includes some of the functions of the statement REPLACE"

For more cleanup rules that introduce newer string syntax, see #36!

Kind regards,
Jörg-Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants