Community

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

    Replace specific number and letter

    Help wanted · · · – – – · · ·
    2
    3
    53
    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.
    • Alexandros Xatzidimitriou
      Alexandros Xatzidimitriou last edited by

      Hello
      ‘Blue1’: ‘0010001000100011’,
      ‘Orange1’: ‘1000100010001000’
      I want to replace number 1 with letter a but I don’t want to change Blue1 and Orange1 text.
      If I use
      Find: \d(‘1)
      Replace: a
      the first number ‘1 and the last number 1’ doesn’t change because there is this symbol (’)… Any solution…? Thanks

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

        Hello @alexandros-xatzidimitriou, and All,

        Do you mean this kind of replacement ? :

        • Initial text :
        'Blue1': '0010001000100011',
        'Orange1': '1000100010001000'
        
        • SEARCH 1(?!':)

        • REPLACE a

        • Final text :

        'Blue1': '00a000a000a000aa',
        'Orange1': 'a000a000a000a000'
        

        Notes :

        • The search regex looks for a 1 digit, ONLY IF NOT  followed with the string ': and replaces it with the lowercase letter a

        • The (?!.......) syntax is a negative look-ahead structure

        Best Regards,

        guy038

        1 Reply Last reply Reply Quote 4
        • Alexandros Xatzidimitriou
          Alexandros Xatzidimitriou last edited by

          Thanks a lot guy038! This is exactly what I was looking for!!!

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