Reputation: 430
I have strings like is below,
nn"h11p3ppppvxq3b288N1 m 227"]
{vanxtageendganmesbhorgtgt(1702)}'
d3zd6xf8dz8xd6dz8f6zd8`
[nn"5rvh11p3ppppvxq3b288N1 n 227"]
{vanxtageendganmesbhorgtgt(1802)}
d3zd6xf8dz8xd6dz8f6zd8
I start my 1st capturing group from m 227 till end of third line,
And my 2nd group from n 227 till end of third line .....
Now I want to add some digits to end of first captured group , say it -22
And some digits to end of second captured group, say it -11
My first regex can match and works separately so 2nd as well .... but to make them combine with |
it doesn't .....
Search: (m\s.*\n.*\n.*)
Replace: $1 -22
My combined regex is as below
(m\s.*\n.*\n.*|n\s.*\n.*\n.*)
Replace: $1-22 $2-11
But this will add (-22 -11) to both intendeds ...
I want the output to be as below
nn"h11p3ppppvxq3b288N1 m 227"]
{vanxtageendganmesbhorgtgt(1702)}
d3zd6xf8dz8xd6dz8f6zd8 -22
[nn"5rvh11p3ppppvxq3b288N1 n 227"]
{vanxtageendganmesbhorgtgt(1802)}
d3zd6xf8dz8xd6dz8f6zd8 -11
I have used |
or for to combine both regexes to works as one for the purpose of time Savage ....
Any help will be appreciated
Upvotes: 1
Views: 55
Reputation: 626754
You can use
Find What: ([mn])\s.*\R.*\R.*
Replace With: $& -$1
Details:
([mn])
- Group 1 ($1
): m
ior n
\s
- a whitespace.*\R.*\R.*
- a line, a line break, then again a line and a line break and then a line.The $&
in the replacement is the backreference to the whole match.
Upvotes: 1