Community

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

    Help with Regex Search and Replace

    Help wanted · · · – – – · · ·
    2
    3
    47
    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.
    • rderekp
      rderekp last edited by rderekp

      Hello! I’m trying to fix and neaten some code and what I’d like to be able to do is a global search and replace which replaces:

      ABC#########WXYZ with ABCWXYZ#########

      There may be between four and nine numbers in the ########## though I don’t mind having to run it once for each possible quantity of numbers.

      ABC WXYZ are all letters and in caps. ABC is the same for each group, but WXYZ can be different.

      the # signs are always representing numbers, and the numbers and letters need to stay the same, just be in a different order.

      Can any expert out there help me with this?

      Thanks!

      Ekopalypse 1 Reply Last reply Reply Quote 0
      • Ekopalypse
        Ekopalypse @rderekp last edited by

        @rderekp

        If I understand correctly you are looking for: (ABC)(\d{4,9})([A-Z]{4})
        and replace with:\1\3\2
        Make sure you have checked regular expression in replace dialog.

        1 Reply Last reply Reply Quote 1
        • rderekp
          rderekp last edited by

          You are my hero! It looks like this fixed my problem, thank you!

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