I would use replaceAll to change the : into “:”
Then I would put double quotes around each line:
I would do a repalceAll (‘(.+)’ , ‘”$1”’) but it is not working
https://regex101.com/r/nRsEmk/1 (this link shows it could)
Maybe a Java Action:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(.+)";
final String string = "BEGIN:VCALENDAR\n"
+ "VERSION:2.0\n"
+ "PRODID:-//ABC Corporation//NONSGML My Product//EN\n"
+ "BEGIN:VTODO\n"
+ "DTSTAMP:19980130T134500Z\n"
+ "SEQUENCE:2etc...";
final String subst = "\"$1\"";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
// The substituted value will be contained in the result variable
final String result = matcher.replaceAll(subst);
System.out.println("Substitution result: " + result);
}
}
I have used the RegexReplaceAll from the Community Commons module when I’ve had to do more complex multiline replacements like this. It’s a lot more powerful than the built in version. However, it is still dropping out to Java and I know you wanted it in standard Mendix.