regex - Regular Expression Search Replace all non leading tabs with single space Notepad++ -
regular expressions have never been strong suite, need here. have text file , want replace "embedded" tabs space , 1 space x occurrences of tabs, leave "leading" tabs alone.
so line looks this:
\t\t\tthis a\t\ttest see\thow things\t work.
would come out looking this:
\t\t\tthis test see how things work.
so tabs left in file @ beginning of lines , there x number of tabs @ beginning of line. can me figure 1 out?
i'm doing notepad++ search/replace use visual studio or other tool if work better.
find what:
(?<!\t)(?!^)\t+
the sequence of tabs \t+
must not preceded tab (?<!\t)
, , must not start beginning of line (?!^)
.
replace with:
<space>
demo on regex101 (since notepad++ uses pcre, use t
instead of tab clarity)
Comments
Post a Comment