Community
    • Login

    How to add asterisk to a list of filenames and make it a line

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    asterisk space
    3 Posts 2 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Sunil KumarS
      Sunil Kumar
      last edited by

      Hello.

      I’ve a list of file names (about 4000).

      For example:
      A-67569
      H-67985
      J-87657
      K-85897
      .
      .
      .

      I need to put asterisk before and after each file name. And make it a line format.

      Example:

      A-67569 H-67985 J-87657 K-85897 …

      Note that there is a space between filenames.

      How can I do it?

      Please advise.

      Thanks

      1 Reply Last reply Reply Quote 1
      • Sunil KumarS
        Sunil Kumar
        last edited by

        After I posted, I noticed it’s not allowing to show the asterisks I put before and after the filenames. So please look at the pic in the link.

        link text

        Thanks

        1 Reply Last reply Reply Quote 1
        • guy038G
          guy038
          last edited by guy038

          Hello @sunil-kumar and All,

          Not difficult with regular expressions ! So :

          • Open the Replace dialog ( Ctrl + H )

          SEARCH (?-s)(.+)\R

          REPLACE *\1*\x20

          • Select the Regular expression search mode

          • Move your cursor to the beginning of your list of files

          • Click several times on the Replace button or once, only, on the Replace All button

          Voilà !

          Notes :

          • As usual, the (?-s) modifier means that the regex dot character ( . ) represents a single standard character

          • Then, the part (.+) stands for any non-empty range of consecutive standard characters, which is stored as group1, as embedded in parentheses

          • The last part, \R matches any kind of line-break ( \r\n, \n or \r )

          • In replacement, we rewrite an asterisk, followed by the filename ( group1 ), followed, again, with an asterisk and, finally, with a space character ( \x20 )

          Best Regards,

          guy038

          P.S. :

          A small drawback is that the last file, of the unique line, is, of course, followed with a space char, too !

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors