Forum Moderators: open
I haven't gotten into either regular expressions or Clip Programming with NTP, but I'm thinking I'd have to use one or the other to accomplish this, if it can be done.
My approach will be to identify a starting string and an ending string, and set up a routine to globally search and replace these and everything in between them. If doable, this would effectively work like the Library Items in DreamWeaver, I'm thinking, and be useful for maintaining global page sections like nav menus.
I'm not really a programmer, but could probably tackle this with a code outline and indications of what syntax I need to learn.
Anyone done this? If Clip Programming is required, this is NTP specific. If regular expressions will suffice, then experience with any text editor supporting regex would probably apply. Thoughts?
An approximate syntax is:
/start text here .+? end text here/
You would need to escape special characters in the 'start text here' and 'end text here' sections.
. means anything, + means one or more of the previous, and the? modifies the + so that it goes for the shortest of possible solutions. All in all, it will look for the shortest string between 'start text here' and 'end text here'.
Altogether:
Search for: /start text here .+? end text here/
Replace with: something else....
Note that this removes 'start text here' and 'end text here'. If you want to keep them, either stick them in brackets in the search regex and access them in the replacement string with $1 and $2 (or similar) or just retype them in the replacement string.
...with Perl type regular expressions...
vvv - I'm not a programmer, but I can follow syntax if I'm pointed to it. Question is whether what you're suggesting can just be entered into the search field, or whether I need to run Perl or some such within my text editor (I ask this sloppily, because I really don't know what's involved).
Way back when I used MS Word for DOS as a text editor, I was able to use its macro and scripting language (which were very easy to use) to do a lot of search and replace routines... even to find strings, move them, and change case.
But here I was just hoping for something very simple... basically something that I could enter into the search and replace fields, maybe with something like regex which I understand NoteTab Pro supports.
NoteTab Pro also has a Clip scripting language that I haven't used. The documentation assumes more of a background in programming than I have.
More or less... with Perl type regular expressions you need to identify the text to change, and then change it.An approximate syntax is:
/start text here .+? end text here/
vvv - Finally have come to understand what you were talking about... ie, you're talking about the particular regular expressions syntax, not about using Perl itself.
When I said I'm not a programmer, I really meant it. ;)
Thanks.