I want to mark the last character from the matched string in regex101 or notepad regex. To be marked the last space before the }.
Here’s my example(tried), Regex: https://regex101.com/r/0QNOD1/1
input:
[]*} %> ~€_€<]%,!!_€~
“ABC/A1/YY-“ abc1
}
!£|€_€{^}?![ }|!¥]
“ABC/A2/YY-“ abc2
}
18,&4&5&4&&1$&((&&1
“ABC/A3/YY-“ abc7
}
Result After Replacement
[]*} %> ~€_€<]%,!!_€~
“ABC/A1/YY-“ abc1
SEND}
!£|€_€{^}?![ }|!¥]
“ABC/A2/YY-“ abc2
SEND}
18,&4&5&4&&1$&((&&1
“ABC/A3/YY-“ abc7
SEND}
CodePudding user response:
You can search using this regex:
ABC/A\d /YY-“\ abc\d \s*[\s\S]? \K(?=})
And replace it with:
SEND
RegEx Details:
ABC/A
: MatchABC/A
\d
: Match 1 digits/YY-“\ abc
:\d
: Match 1 digits\s*
: Match 0 whitespaces[\s\S]?
: Match an optional character including line break.?
is possessive quantifier.\K
: Reset match info(?=})
: Lookahead to make sure we have}
at next position