REPLACE ALL OCCURENCES OF REGEX does not work?

Jagger

Here is one for ya.

I want to insert line breaks in a very long string using REPLACE ALL OCCURENCES OF REGEX. Unfortunately it does not work. It inserts the line break only one time at the very beginning then does nothing with the remaining string.

`Lorem ipsum dolor sit amet, consectetur ` &&#adipiscing elit. Proin sagittis tortor at

Here is my program.

REPORT zzz.

START-OF-SELECTION.
  DATA(gv_string) =
`Lorem ipsum dolor sit amet, consectetur ` &&
`adipiscing elit. Proin sagittis tortor a` &&
`t bibendum eleifend. Cras nisi felis, ac` &&
`cumsan vitae euismod eget, viverra sed i` &&
`psum. Integer imperdiet eleifend interdu` &&
`m. Nunc sed ultrices lectus. Sed nisi ex` &&
`, tincidunt quis arcu eget, commodo temp` &&
`or odio. In hac habitasse platea dictums` &&
`t. Nunc sit amet convallis ex, in conseq` &&
`uat velit. In suscipit orci lectus, laor` &&
`eet pretium leo molestie non. Duis trist` &&
`ique ipsum non porta faucibus. Nullam ia` &&
`culis rutrum arcu, sit amet rhoncus mass` &&
`a interdum at. Donec luctus magna metus,` &&
` et varius massa euismod vel. Nunc sem s` &&
`em, lobortis et convallis nec, aliquam e` &&
`u nunc. Nullam quis sollicitudin ante. N` &&
`ulla suscipit eu ante lobortis sodales. ` &&
`Cras mattis enim a leo pellentesque, ut ` &&
`interdum orci rutrum. Fusce varius matti` &&
`s pulvinar. Lorem ipsum dolor sit amet, ` &&
`consectetur adipiscing elit. Integer mol` &&
`estie ipsum et aliquam porttitor. Phasel` &&
`lus consectetur viverra sem. Aenean cons` &&
`equat eros eget rutrum tempus. Aliquam e` &&
`rat volutpat. Vivamus venenatis pharetra` &&
` eleifend. Integer pulvinar ipsum ac pul` &&
`vinar efficitur. Mauris venenatis justo ` &&
`vel arcu viverra, a laoreet massa pellen` &&
`tesque. Nunc eu ex magna. Quisque ultric` &&
`es convallis elementum. Mauris vel torto` &&
`r elementum, placerat odio sit amet, mat` &&
`tis neque. Vestibulum pellentesque finib` &&
`us metus, eget semper mi. Pellentesque i` &&
`d est porta, accumsan nisl eu, laoreet d` &&
`iam. Ut at hendrerit leo. Donec vestibul` &&
`um hendrerit nisi. Pellentesque non augu` &&
`e ac ipsum ultricies egestas quis a urna` &&
`. Nam varius sollicitudin nibh, vel comm` &&
`odo lorem placerat sed. Phasellus ut dia` &&
`m ac dolor condimentum rhoncus ac vel ex` &&
`. Donec finibus urna quis tempus ultrice` &&
`s. Donec id pellentesque ante, sed gravi` &&
`da diam. Cras metus lorem, rutrum non po` &&
`rttitor sed, posuere et neque. Phasellus` &&
` efficitur bibendum volutpat. Integer fa` &&
`ucibus neque at est sollicitudin bibendu` &&
`m. Cras eleifend nunc lacus, sed fringil` &&
`la erat vestibulum ac. Praesent ipsum fe` &&
`lis, porta vel urna vitae, consequat var` &&
`ius velit. Suspendisse tristique bibendu` &&
`m ante vel convallis. Aliquam tincidunt ` &&
`nec ipsum eu pretium. Donec vitae ultric` &&
`es nibh.`.

REPLACE ALL OCCURRENCES OF REGEX `^.{40}` IN gv_string WITH '`$0` &&\n'.
BREAK-POINT.

The regular expression ^.{40} and the replacement string I use are for sure correct, because I get the result I want for example in Notepad++.

Is this some kind of a bug or is this documented somewhere as a constraint in ABAP-RegEx?

József Szikszai

Remove the ^ from the regex expression, to insert a line break every 40 characters:

REPLACE ALL OCCURRENCES OF REGEX `^.{40}` IN gv_string WITH '`$0` &&\n'.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Java replace all occurences of regex with another regex

Javascript: Replace all occurences of ' a ' in a string with ' b ' with a regex

Regex replace all occurences of a word unless its the last word

Using Regex replace all occurences of string within VQMod

Capturing all occurences with RegEx

Replace occurences of string corresponding to a regex

Java - Replace all occurences of '${' in string

Replace all occurences of \ except \N

Replace regex does not work with sed

Powershell with regex: Unable to find and replace ALL occurences of specified string in a set of data

Replace all occurences of one word in string in python

Replace text between '=' and '?' on all occurences in URL string

How to replace all occurences except the first one?

How to replace all the occurences but one in Python

Find and replace all occurences of a string in a range

Replace all occurences of custom tag with URL in it [JS]

Replace all Occurences of '.' with '_' before '=' using sed

Regex for all occurences between a single character

finding all occurences of date in a string with regex

How to get matched index of a regex for all occurences

RegEx Matching all occurences of "//" but not when part of "http://"

regex all occurences of a string after Symbol =

Match similar string in regex, but not all occurences

Pandas replace regex: why this negation does not work

std::regex_replace replace n occurences and get number of substitutions

PHP replace all occurences with preg_replace_callback

Why would the replace with regex not work even though the regex does?

Use Regex to replace text between multiple occurences of tags

Replace all occurences of a string in data frame without disturbing the original structure

TOP Ranking

HotTag

Archive