Reputation: 1319
I want to replace quotation marks in a big file in this cases:
Replace:
M 100644 367cb229 "DFA/OETK/oetk_settings/Sony DADC Demo_with_pass.p12"
By:
M 100644 367cb229 DFA/OETK/oetk_settings/Sony DADC Demo_with_pass.p12
But I don´t want to replace all the quotation marks of the document, only this specific cases.
Can anybody help me?
Upvotes: 0
Views: 310
Reputation: 92976
Try this as pattern
^(?=M \d{6}\b)(.*?)"(.*?)"
and this as replacement
$1$2
^
is matching the start of the row
(?=M \d{6}\b)
is a positive lookahead assertion, that ensures that the row starts with M \d{6}
\d{6}
are six digits
\b
is a wordboundary, it ensures, that there is a non word character after the last digit, otherwise it would be also true if there are more than 6 digits.
(.*?)
is matching as less as possible till the following pattern. What is matched is stored and that string can be retrieved by using $1
for the first group, $2
for the second group, ...
Upvotes: 1
Reputation: 962
Use this Find expression:
(M \d{6} [^"]*)"([^"]*)"
And this Replace expression
$1$2
I this the first part (M \d{6} [^"]*)
selects M 100644 367cb229
- character M followed by 6 numbers and then anything till a "
.
The second part ([^"]*)
selects DFA/OETK/oetk_settings/Sony DADC Demo_with_pass.p12
- the text within the quotes.
Any text within parenthesis is captured by $1
, $2
, etc and can be used in replace.
See if this matches for all cases
Upvotes: 0