Replace specific number and letter



  • 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



  • 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



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


Log in to reply