Page 1 of 1
Replace at a precise position
Posted: Tue Apr 10, 2001 1:13 am
by Arnold McRae
How can I replace a character at a precise position with TextPad? Let say I have a "." at column 32 and I want to replace that character only when it has been found at that position.
TIA
Arnold
Re: Replace at a precise position
Posted: Tue Apr 10, 2001 6:45 am
by Andreas
Search for
^\(.\{31,31\}\)\..
with regex activated
and replace with
\1whateveryouwanttoreplaceforthedot
^ starts the search at start of line
with \(\) you remember what's found for replacement
with \1 you put the first \(\) content in the replacement
. finds any character
\{31,31\} says you want to find at least 31 (first value) and at most 31 (second value) times what is left of it (which is the . to match any character). Result: you find exactly 31 characters
\. finds a . (not to mix up with the "any character")
So the above expression
searches for 31 characters at the start of a line followed by a .
and replaces it with
the same 31 characters followed by whateveryouwanttoreplaceforthedot
Re: Replace at a precise position
Posted: Sun Jul 15, 2001 5:18 pm
by Susan Hunt
wouldnt it be easier to:
turn word wrap off
click configure, block select mode on
to select the text to be replaced:
put your cursor on col 32 & drag it down however far u want.
click ctrl-H or search, replace
& ensure box 'selected text' is checked
put your period in the from box
ignore the to box.
click replace all