I am making a application where I am using some auto generate regular expressions which are multi line is the reg Ex string contains \n.
Now every time i execute a generate command i would like to print the command to console also for documentation ect.
INFO: Command execute: (regular expression) however if i just print my Reg Ex string containing the \n I also get newline in the printout which is not desirable.
INFO: Command execute: (regular expre ssion) I can get it to print the newline \n by adding an escape char making it \\n and it is also how it looks on the print out.
INFO: Command execute: (regular expre\\nssion) This is not desirable either. What I am looking for is to be able to print it like following.
INFO: Command execute: (regular expre\nssion) Is this possible ?
regards
print('regular expre\\nssion')prints'regular expre\nssion'on my computerre.escape(my_str)to make a fully valid regular expression compatible string. The i compile it and print it usingprint(compiledStr.pattern). However I found that the pattern string was\\\nand that was why it wasnt not working. i replace the\\\nwith\\nand i get your result.