Say I have a text:
Multiple words
In yellow and in blue
How can I make it to this?
multiple-words as "Multiple words"
in-yellow-and-in-blue as "In yellow and in blue"
So far my best try is this:
- Find:
(.*)
- Replace:
-\1- as "\1"
To have it in the form of -Multiple words- as "Multiple words"
. The -
is to mark the boundary easier. But I can't tell it to only replace the spaces in between the boundaries.
CodePudding user response:
You can do that in several steps:
- Search for
^.*$
and replace with$& as "$&"
: it just wraps all lines with quotes. - Search for
(?:\G|^\S*)\K\h (?=.* as ".*"$)
and replace with-
: it replaces all horizontal whitespaces (\h
) from the start of the line till aas "..."
pattern. - Search for
(?:\G-|^)[^-] (?=\S* as ".*"$)
and replace with\L$&
: it will turn to lowercase all chunks of non-hyphen chars from the start of string tillas "..."
pattern.
Note \L
, \U
and other case changing operators do not work with non-ASCII letters in Notepad .