I would like to replace the following lines
load 30285 "1 " 0
load 12345 "1 " 0
.....................
....................
load xxxxx "1 " 0
to the below lines in my file using replace function in Texpad
load 30285 0 "1 " 0
load 12345 0 "1 " 0
.....................
....................
load xxxxx "0 1 " 0
Adding extra data (one digit number,0)to all existing lines
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
I would use the following:
This searches for all instances of a line starting with (^) the string 'load' followed by a space and 5 digits. It replaces it with 'load', the same 5 digits (\1 inserting the matching characters within the first set of brackets) and the extra '0' character.
Edit: A correction to the explanatory text.
Hope this helps.
Note: There's a space after the '0' in the replacement expression.Find what: ^load ([0-9]{5})
Replace with: load \1 0
[X] Regular expression
Replace All
This searches for all instances of a line starting with (^) the string 'load' followed by a space and 5 digits. It replaces it with 'load', the same 5 digits (\1 inserting the matching characters within the first set of brackets) and the extra '0' character.
Edit: A correction to the explanatory text.
Hope this helps.
Last edited by SteveH on Tue Jul 26, 2011 4:24 pm, edited 1 time in total.
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.
-
- Posts: 2457
- Joined: Sun Mar 02, 2003 9:22 pm
SteveH's solution assumes you are using "Posix" regular expression syntax:
The expression /1 in the body of his message should be \1, as in the suggestion itself.
The ^ in the regular expression matches at the beginnings of lines.Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
The expression /1 in the body of his message should be \1, as in the suggestion itself.