Reputation: 2369
I have an xml manifest that I need to replace the spaces with underscores in. It looks like this:
<file href="MOSQ_19D_NEW/references/FM 21-75.pdf" />
<file href="MOSQ_19D_NEW/references/FM 3-01.80.pdf" />
<file href="MOSQ_19D_NEW/references/FM 3-09.30 TTPs for Observed Fire and Fire Support at BN Task Force and Below.pdf" />
So I need to find where there is a space and replace with an underscore between the xml brackets and the qoutes. I have to do this manually very often at my job.
I have tried many things but cannot figure this out.
Upvotes: 2
Views: 4997
Reputation: 26940
Your solution is this:
(?<=".*) (?=.*")
Unfortunately, notepad++ doesn't support zero width assertions, therefore you will have to either :
(href="\S*)\s(.*?")
replace with \1_\2
repeatedlyUntil no more replacements are possible.
Upvotes: 1
Reputation: 4926
Here's a crappy, but maybe helpful solution:
Find what: (".*) (.*")
Replace with: \1_\2
It's crappy, because you'll have to "Replace all" as many times as the maximum number of a spaces there can be in a single line. So if you have 1000 lines, and but there's at most 5 spaces in a single line, you'll have to "Replace all" for 5 times.
Upvotes: 1