Hello, sorry for my noobness about regular expressions but I need something as simple as just adding +25 to the final number. Its a big line but only the final 3 numbers that matter:
Example:
563474.7900 9698470.1500 4 MNH152.06@R00357
563415.4200 9698332.9000 3 MNH152.06@R00357
563365.9800 9698192.5000 2 MNH152.06@R00357
563315.6300 9698050.6800 1 MNH152.06@R00357
needs to become
563474.7900 9698470.1500 4 MNH152.06@R00382
563415.4200 9698332.9000 3 MNH152.06@R00382
563365.9800 9698192.5000 2 MNH152.06@R00382
563315.6300 9698050.6800 1 MNH152.06@R00382
There SO many files with that behavior, if anyone could help to find an expression to just replace the last 3 numbers (column 85, 86, 87) with +25 it would be extremely appreciated.
Addition to the last numbers
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Unfortunately, it isn't simple. Regular expressions can't count or add: all they know about is uninterpreted characters. In principle you can do this, but not with a single search-and-replace operation. It would be very tedious and would require many separate and different search-and-replace operations.
This is a job for a script in a suitable language, such as Perl, Python, Ruby, Tcl, ECMAscript or Lua. TextPad doesn't support scripts.
This is a job for a script in a suitable language, such as Perl, Python, Ruby, Tcl, ECMAscript or Lua. TextPad doesn't support scripts.
Re: Addition to the last numbers
You could do this easily in PhraseExpress:Kiroptus wrote:If anyone could help to find an expression to just replace the last 3 numbers (column 85, 86, 87) with +25 it would be extremely appreciated.
Code: Select all
- zProcessAllLines:
{#LOOP zProcessLine -count {#INPUT -head How many lines to process? -single}}
- zProcessLine:
{#RIGHT -count 85}{#SHIFT {#END}}{#CLIPBOARD -copy}{#CALC {#CLIPBOARD -paste} + 25 -round 0 -thousands none}{#RIGHT}
Actually, if it truly is the last three characters, then this is better:
Code: Select all
- zProcessLine:
{#END}{#SHIFT {#LEFT -count 3}}{#CLIPBOARD -copy}{#CALC {#CLIPBOARD -paste} + 25 -round 0 -thousands none}{#RIGHT}