I have several webpages I need to insert text into.
How can I find the last </p> in the file and insert text before the last </p>
So find
last instance of </p>
Replace with
****SOMETEXT \n </p>
Find last </p> in file
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
I don't think you can do this with TextPad's RegEx, but you might make a macro that goes to the end of the file, do a Search, UP vs. Down, and insert your text.
Or use a macro to locate the last </p> as above, and add a unique character (~ ?) in front of or behind it.
Now you can use RegEx to locate </p>~
Or use a macro to locate the last </p> as above, and add a unique character (~ ?) in front of or behind it.
Now you can use RegEx to locate </p>~
Hope this was helpful.............good luck,
Bob
Bob
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
You can do it in WildEdit (http://www.textpad.com/products/wildedit/):
An interesting alternative is:Find what:
(.*)</p>
Replace with:
$1****SOMETEXT
</p>
[X] Regular expression
[X] Replacement format
Options
[ ] '.' does not match a newline character [i.e., not selected]
(The undocumented \z matches the end of the text. See http://www.boost.org/libs/regex/.)Find what:
</p>(((?!</p>).)*)\z
Replace with:
****SOMETEXT
</p>$1
[X] Regular expression
[X] Replacement format
Options
[ ] '.' does not match a newline character [i.e., not selected]