Regex match all lines that don't end with ,0 and ,1

前端 未结 4 1714
刺人心
刺人心 2020-12-21 10:18

I have a malformed CSV file which has two columns: Text,Value

The value is either 1 or 0, but some lines are malformed and span two lines:

1. \"This          


        
4条回答
  •  [愿得一人]
    2020-12-21 10:26

    The expression you would use is

    ([^,].|,[^01])$
    

    But unfortunately, notepad++ does not support alternation (the | operator). [1] You can match the broken lines with these two expressions then:

    [^,].$
    ,[^01]$
    

    Except, of course, if the "Text" part does end in ,0 or ,1 itself. :-)

    [1] http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Unsupported_Regex_Operators

提交回复
热议问题