I would like to select all whitespaces except the last occurrence on each line so that I can replace the whitespaces with a single delimiter for import purposes.
The matches are all groups of whitespaces. There are CRLF at the end of each line. I tried with and without $, \\r\\n etc.. I feel like I am missing soemthing very obvious but wasnt able to pin it down with google so far.
I tried negative lookahead already. Unfortunately in Notepad++ the CRLF is included in the match, so that when I try to replace the data it strips away the new line.
If I understand well what you are trying to do,
with regexpal (check the m modifier box):
(?=([^\r\n\S]+))\1(?!$)
where (?=(...))\\1
is a trick to emulate an atomic group with javascript and [^\\r\\n\\S]
is like \\s
but without \\r
and \\n
with notepad++:
\h++(?!$)
where \\h
stands for any horizontal whitespace (this class is not available in javascript too) and ++ is a possessive quantifier . Note that by default $
means the end of the line in notepad++.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.