I would like to know if it is possible to have textpad highlight all words that start with the same two letters. I am currently working with a new CAD/CAM system. They have a great macro program in it but now editor. I was hoping to get textpad to work with it much like it works with AutoLisp.
Thanks For any input.
Highlighting all words that start with the same two letters
Moderators: AmigoJack, bbadmin, helios, MudGuard
-
MachineSMMC
- Posts: 1
- Joined: Mon Dec 01, 2003 11:50 pm
- Location: MN
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
TextPad does not allow multiple selections. And you cannot easily color or bold those choices. And I don't think you can make keywords for the syntax file that uses wildcards or RegEx.
But let me offer 3 options: 1-Mark all lines, 2-use a word processor and macro program, 3-treat as an HTML document.
Note: Using underscore "_" in following examples to represent space character for display purposes.
========================
Option 1- Mark all lines
Go to beginning of document.
Open Find window.
Find using RegEX for "space, LETTER_A, LETTER_B, one_or_more_of_any alpha-numberic_characters.:_AB[a-zA-Z0-9]+
Click on Mark All.
========================
Option 2 - Word processor and macro program
If you could make bold or color, you could do the following:
Make a macro to do the following:
Make a hot key to Select Word
Go to beginning of document.
Find using RegEX for "space, LETTER_A, LETTER_B, one_or_more_of_any alpha-numberic_characters.:_AB[a-zA-Z0-9]+Close Find window and go to that word on the document.
Press left arrow, right arrow to start at beginning of word.
Press SelectWord hot key
Apply color/font as desired.
Repeat macro to end of file.
- - - - - - - - - -
Even if you could bold/color, you would have trouble saving with those enhancements.
I would probably use a tool like Macro Scheduler to copy the text to a word processor document that allows formatting and then perform the same steps as noted above in the second option that uses another program with formatting.
========================
Option 3 - Treat as HTML document.
The best method might be to treat the document as HTML and add HTML code by doing a search and replace like this:
But let me offer 3 options: 1-Mark all lines, 2-use a word processor and macro program, 3-treat as an HTML document.
Note: Using underscore "_" in following examples to represent space character for display purposes.
========================
Option 1- Mark all lines
Go to beginning of document.
Open Find window.
Find using RegEX for "space, LETTER_A, LETTER_B, one_or_more_of_any alpha-numberic_characters.:_AB[a-zA-Z0-9]+
Click on Mark All.
========================
Option 2 - Word processor and macro program
If you could make bold or color, you could do the following:
Make a macro to do the following:
Make a hot key to Select Word
Go to beginning of document.
Find using RegEX for "space, LETTER_A, LETTER_B, one_or_more_of_any alpha-numberic_characters.:_AB[a-zA-Z0-9]+Close Find window and go to that word on the document.
Press left arrow, right arrow to start at beginning of word.
Press SelectWord hot key
Apply color/font as desired.
Repeat macro to end of file.
- - - - - - - - - -
Even if you could bold/color, you would have trouble saving with those enhancements.
I would probably use a tool like Macro Scheduler to copy the text to a word processor document that allows formatting and then perform the same steps as noted above in the second option that uses another program with formatting.
========================
Option 3 - Treat as HTML document.
Now save it as an HTML document to retain bold formatting.Search for:_(AB[a-zA-Z0-9]+)
Replace with: _<b>\1</b>
Hope this was helpful.............good luck,
Bob
Bob
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
Good catch MudGuard.
So new expressions, with a few more characters for words, are:
Search for:
(\<AB[a-zA-Z0-9'-_]+)
Replace with:
<b>\1</b>
Note that this underscore "_" is real, not for a space character.
Explanation of RegEx expressions:
RegEx Search expression:
(.....................= beginning of first tagged expression
\<..................= beginning of word
AB................. = AB
[a-zA-Z0-9'-_]..... = any alpha-numeric character or apostrophe, hyphen, underscore (other characters can be added)
+...................= one or more of previous term
)................... = end of first tagged expression
RegEx Replace expression:
<b>.............= HTML code for starting BOLD
\1................= first tagged expression
</b>...........= HTML code to end BOLD
And save as HTML.
So new expressions, with a few more characters for words, are:
Search for:
(\<AB[a-zA-Z0-9'-_]+)
Replace with:
<b>\1</b>
Note that this underscore "_" is real, not for a space character.
Explanation of RegEx expressions:
RegEx Search expression:
(.....................= beginning of first tagged expression
\<..................= beginning of word
AB................. = AB
[a-zA-Z0-9'-_]..... = any alpha-numeric character or apostrophe, hyphen, underscore (other characters can be added)
+...................= one or more of previous term
)................... = end of first tagged expression
RegEx Replace expression:
<b>.............= HTML code for starting BOLD
\1................= first tagged expression
</b>...........= HTML code to end BOLD
And save as HTML.
Hope this was helpful.............good luck,
Bob
Bob