I have string and I modify this string using the code below:
The input is:
The code that I use is:
The output is this:
content = content.replaceAll("(?m)^.*?(?=keyword)", "")
Now, I would like to change this regexp in such a way that the output will be like this for the same input:
As you can see, the difference between the previous output and this one is the -d flag in the front. The idea is to keep the -d flag if there is any and do the rest same.
The input data is in one big string. I would prefer to do it in one regexp instead of looping through the lines.
How can I do?