regex – Replace a letter on a line starting with a certain string
As what I suggested in comments was what you needed, I will post it here.
You can match the characters from the start of the line up to the “J” it finds, and capture this (except the “J”) in a group (using parentheses). As you have indicated there will be at most one “F” on a line that starts with “G397”, this will effectively find all occurrences.
The replacement can reproduce the group that was captured with $1.
So hit open the find & replace dialog with Ctrl+H, and fill in:
Find what:
^(G379.*)F
Replace with:$1J
Search mode:
⦿ Regular expression ☐ . matches newline
…and Replace All
NB: if you need to find or insert a special character like (, make sure to escape it with a backslash.
Read more here: Source link
