Hi, I am trying to use the regular expression to do a fidn and replace, I want to chage:
[1] McGilvary, Half Century, 1912.
to:
[<a name="1">1</a>] McGilvary, Half Century, 1912.
ie. find:
[ NUM ]
replace:
[ <a name="NUM"> NUM </a> ]
(NUM called be 1 - 2 digits)
I read the help file, and came up with something that looked like,
[:digit:]
But I couldn't even get the find to work.
Thanks for any help.
Find and replace
Moderators: AmigoJack, bbadmin, helios, MudGuard
Please try implementing the following procedure in TextPad:
1. Open the Replace dialog box
2. Type or paste "\[([0-9]+)\]" without the quotes into the "Find what"
section
3. Type or paste "[<a name="\1">\1</a>]" without the quotes into the "Replace with" section
4. Under the heading "Conditions", check "Text and Regular expression"
5. Ensure the curser is at the beginning of the document
6. Click Find Next and Replace, or Replace All
I have used POSIX regular expression syntax, which can be selected from the Editor page of the Preferences dialog box.
1. Open the Replace dialog box
2. Type or paste "\[([0-9]+)\]" without the quotes into the "Find what"
section
3. Type or paste "[<a name="\1">\1</a>]" without the quotes into the "Replace with" section
4. Under the heading "Conditions", check "Text and Regular expression"
5. Ensure the curser is at the beginning of the document
6. Click Find Next and Replace, or Replace All
I have used POSIX regular expression syntax, which can be selected from the Editor page of the Preferences dialog box.
Helios Software Solutions
-
alloneword
- Posts: 2
- Joined: Tue Dec 16, 2003 11:20 am