I need to reformat a text file a bit in my Notepad++ and I have a text of this kind:
This is some example text. This is some example text. This is some example text.
– This is some example text.
-This is some example text.
– This is some example text.
– This is some example text.
So as you can see in above text there are two types of “-” preceeding text the one with the space after “-” and ones without it I need to find only the ones without sapce and add it in between “-” and the “text”
If I ran piece of code below
-[A-Za-z0-9]
it finds dash and first letter right after it, which is not useful as when I replace the text it changes this first letter which is always different (depending on what is written) so I need to find this and select only the “-” and then replace it with “- ” unless there is better way.
For demonstration purposes:
The parentheses denote a capture group. In the Replace with line, you use backslash and the number of group to add it.
That said, what you really want to match for is a NOT group, like
-([^\s])(match where a dash isn’t immediately followed by a whitespace).