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 2.0k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors