Help With Formula, Please...



  • Hi,

    this is a part of the file I need to alter with a formula, as there are many lines to deal with.

    BEGIN "[i 187]"    Id.i 187  Id.u 4934178  Type Stack  SubType 0  Pos.x 293.6555  Pos.y 235.4998  Contents Log  Quantity 2  END
    BEGIN "[i 188]"    Id.i 188  Id.u 237  Type Tree  SubType 2  Pos.x 321.4425  Pos.y 94.39978  Age 7200.000  END
    BEGIN "[i 189]"    Id.i 189  Id.u 238  Type Tree  SubType 2  Pos.x 321.3396  Pos.y 118.1421  Age 7200.000  END
    BEGIN "[i 190]"    Id.i 190  Id.u 239  Type Tree  SubType 2  Pos.x 320.5199  Pos.y 121.2068  Age 7200.000  END
    BEGIN "[i 191]"    Id.i 191  Id.u 4100607  Type Light  SubType 0  Pos.x 157.5000  Pos.y 164.5000  Powered true  On true  END
    BEGIN "[i 192]"    Id.i 192  Id.u 2593664  Type Tree  SubType 2  Pos.x 344.5000  Pos.y 43.50000  Age 7200.000  END
    BEGIN "[i 193]"    Id.i 193  Id.u 4973196  Type Tree  SubType 3  Pos.x 331.5000  Pos.y 175.5000  Age 277.8185  END
    BEGIN "[i 194]"    Id.i 194  Id.u 243  Type Tree  SubType 2  Pos.x 321.2389  Pos.y 119.6723  Age 7200.000  END
    BEGIN "[i 195]"    Id.i 195  Id.u 2660144  Type Tree  SubType 3  Pos.x 342.5000  Pos.y 56.50000  Age 7200.000  END
    BEGIN "[i 196]"    Id.i 196  Id.u 4986243  Type Tree  SubType 1  Pos.x 337.5000  Pos.y 205.5000  Age 258.9519  END
    BEGIN "[i 197]"    Id.i 197  Id.u 4986332  Type Stack  SubType 0  Pos.x 385.5131  Pos.y 166.6089  Contents Log  Quantity 6  LastAccess 54200.48  END
    

    the two lines, for this example, are the following two lines:

    BEGIN "[i 187]"    Id.i 187  Id.u 4934178  Type Stack  SubType 0  Pos.x 293.6555  Pos.y 235.4998  Contents Log  Quantity 2  END
    
    BEGIN "[i 197]"    Id.i 197  Id.u 4986332  Type Stack  SubType 0  Pos.x 385.5131  Pos.y 166.6089  Contents Log  Quantity 6  LastAccess 54200.48  END
    

    how do I (or can I) structure the search and replace to search for “Stack”, “Log” , and “Quantity”…and change that number (2 or 6) to something else…without changing the rest of those lines (or any others for that matter)



  • I had figured it would be something like:

    Find what: Stack .+ Log .+ Quantity \K.+(?= LastAccess)

    or

    Find what: Stack .+ Log .+ Quantity \K.+(?= END)

    and replace with 1000 (a good example number)

    but I can’t get that to work…I don’t know if I’m not typing something right, or if am missing some sort of computer formula logic…anyone know anything about that method??? or any other for that matter.



  • figured it out, I think: disregard this



  • Hello bill clinton,

    Depending on the restriction’s level, that you would like to, just use ONE of the three regexes, below and replace with a specific number, say 1000

    • Find what : (?-is)Quantity +\K\d+

    • Find what : (?-is)Stack.+Quantity +\K\d+

    • Find what : (?-is)Stack.+Log.+Quantity +\K\d+

    and :

    • Replace with : 1000

    Notes :

    • Of course, the Regular expression search mode will be checked

    • The (?-is) modifiers, at the beginning, force the regex engine to do the search :

      • In an NON-insensitive case way, ( -i ) modifier

      • NOT as a single line, ( -s ) modifier. This means that the DOT does NOT match any End of Line characters. On the contrary, (?s), the DOT would match ALL the characters. So, for instance, the regex search (?s).+ is really identical, to CTRL + A !

      • Thus, because of these modifiers, you do NOT have to care about the state of Match case and . matches newline options !

    Best Regards,

    guy038


Log in to reply