Find, highlight and replace certain characters within a word and within a 5 digit numbers using REGEX



  • Need help using REGEX to find, highlight and replace certain words and characters within a word and within a number.
    It will be done using the file below. I has tabs, spaces and non breakable spaces usually inserted by MS office suite programs excel and word.

    UMTS U81M200LEONE 3G_Leone-4 -14.3479 -170.781 4357 28 42004 240
    UMTS U81M203TAFUNA 3G_Tafuna-1 -14.3235 -170.7172 4357 80 42031 130

    I would want to find and replace the word TAFUNA within the word U81M203TAFUNA. It can be either the numbers or the all last letters after 203. The length of the letters to be replaced can be until 64 characters

    I also like to do the same, find and replace with this number 42031. I like to change the number 203 within the 5 digit number. I also would like to change the first digit “4” and make it “2”

    I hope to do it with Regex for convenience and help me understand and learn a bit on how to use it.



  • Hello, Badz Tuviera,

    I’m really sorry, but I did not fully understand what you want to achieve :-(

    Seemingly, you didn’t say what are the replacement strings, for either, the word TAFUNA and the number 203, in the five digits number 42031. May be, did you mean that you want to delete them ?

    But I did understand that the first digit 4 of the number 42031 must be replaced by the digit 2 !

    So, giving your original text, below :

    UMTS U81M200LEONE 3G_Leone-4 -14.3479 -170.781 4357 28 42004 240
    UMTS U81M203TAFUNA 3G_Tafuna-1 -14.3235 -170.7172 4357 80 42031 130
    

    Which modified text do you expect to ?

    May be, you can provide some additional examples or explanations ! As usual, when a problem is clearly defined, the solution is “half” found !

    Best Regards,

    guy038


Log in to reply