Reputation: 11560
I want to insert newline character in regex replace what field.
For example:
Find With: (xyxyxy.*[\r\n]+)(yzyzyz)
Replace with: $1xyxyxy\r\nxyxyxy
also tried replace with: $1xyxyxy$r$nxyxyxy
None of them seems to be working.
Question is what is the mantra to insert carriage return and/or new line via regex replace.
Upvotes: 1
Views: 3147
Reputation: 87203
You can capture the newline characters and use that in replacement. By capturing the newline characters, you don't have to worry about differences in different OS representation of newline.
Find:
(xyxyxy.*(\r\n|\r|\n)+)(yzyzyz)
Replace:
$1$2$3
$2
: Is the single newline character.
Upvotes: 7