create search string for windows

bbb
2014-06-27
2014-06-27
  • bbb
    bbb
    2014-06-27

    how do I take the following:
    V7I12F2VV4D04N2G14102T22I5
    V7I1CA2RD1A0482JV2I12N32K4
    V7M13I2OV5G1462K40103826L7
    V7O16O1LS1L14F24K5E09G2SB6
    V7P02K31B4L14R2RD161491182
    V7Q17M3MR0604126J0R03I3V87

    and create this?
    V7I12F2VV4D04N2G14102T22I5; V7I1CA2RD1A0482JV2I12N32K4; V7M13I2OV5G1462K40103826L7; V7O16O1LS1L14F24K5E09G2SB6; V7P02K31B4L14R2RD161491182; V7Q17M3MR0604126J0R03I3V87

     
  • Open search and replace, check "Regular expression" and make sure ". matches newline" ISN'T checked.

    Make sure there is an empty line at the end of the document.

    Then replace

    (.*)\r\n(.*)\r\n
    

    with

    \1; \2;\r\n
    

    Remove empty line and superfluous semicolon at the end.

     
    Last edit: Andreas Jonsson 2014-06-27
    • bbb
      bbb
      2014-06-27

      how do I make the final output 1 continuous line

       
  • bbb
    bbb
    2014-06-27

    how do I make the final output 1 continuous line

     
  • THEVENOT Guy
    THEVENOT Guy
    2014-06-27

    Hello bbb

    I understood why your last two lines are NOT joined in a single line : I suppose that your last line doesn't end with the EOL characters of Windows ( \r\n ). Then, the last \r\n, of the regex, can't be matched and NO replacement occurs !

    So, either you add a new line after your last line or you follow the method below :

    • Go to the beginning of your list ( CTRL + Org )

    • Open the Replace dialog ( CTRL + H )

    • Fill in the regex, below, in the Find what field :

    (.+)\R(.+)\R?

    • Fill in the regex, below, in the Replace with field :

    \1; \2; \r\n

    • Check the Wrap around option

    • Select the Regular expression search mode

    • Uncheck, if necessary, the . matches newline option

    • Click on the Replace All button

    Et voilà !

    Notes :

    • In the SEARCH part, I replace the \r\n ( Windows EOL ) by the form \R which represents ANY kind of EOL ( Windows, Unix, MAC )

    • I changed the form .* into .+, because I suppose that your list doesn't contain empty lines

    • The second form \R is optional to match the particular case of a last line, NOT ending with an EOL

    • If the number of lines of your list is odd, this regex doesn't match/change this last line

    Best Regards,

    guy038

    You'll find good documentation, about the new Boost C++ Regex library ( similar to the PERL Regular Common Expressions ) used by Notepad++, since the 6.0 version, at the TWO addresses below :

    http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html

    http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html

    • The FIRST link explains the syntax, of regular expressions, in the SEARCH part

    • The SECOND link explains the syntax, of regular expressions, in the REPLACEMENT part

     
    Last edit: THEVENOT Guy 2014-06-28