Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to transfer wildcards from FIND to REPLACE

    Help wanted · · · – – – · · ·
    3
    3
    79
    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.
    • Danny Spence
      Danny Spence last edited by

      I have a group of dates where i want to make into a comma delimited file and i can FIND the range with something like “Feb/1.” as a Regular Expression. With that, i can find Feb/10, Feb/11, Feb/12, Feb/13, ect, but i dont know the syntax to translate that wildcard (.) over to the REPLACE field. If i FIND “Feb/10” I want it replaced with “Feb/10,”. Each element needs to be represented in the replace expression. All the answers i have found focus on the FIND expression.

      PeterJones Neil Schipper 2 Replies Last reply Reply Quote 0
      • PeterJones
        PeterJones @Danny Spence last edited by PeterJones

        @danny-spence

        FIND = Feb/1.
        REPLACE = ${0},
        SEARCH MODE = regular expression

        The $0 or ${0} in the replacement means “use the enter entire string found in FIND as part of the replacement”. This is documented in the npp-user-manual.org’s [Searching > Regular Expressions > Substitution section.

        1 Reply Last reply Reply Quote 2
        • Neil Schipper
          Neil Schipper @Danny Spence last edited by

          @danny-spence You should try to describe in a more precise and complete way all the types of strings you wanted altered. If you are happy doing a separate F&R operation for every date of interest, that’s what Peter’s solution provides. If you wish to alter every Feb date, you need something like Feb/\d+. If you wish to alter a restricted range of dates in Feb like say 8th to 23th, you need something a bit more complex. If you wish to alter every date in the format you’ve shown, you need something like (Jan|Feb|..etc..|Dec)/\d+. Try to eliminate the need for your readers to do guesswork.

          1 Reply Last reply Reply Quote 3
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors