Re: macro to highlight text in carrots

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"jkmar5" wrote:
Is there a macro that I could use to highlight text in carrots? I would
like
the dark gray highlighting color.

For example, here is a section of the document.
<question>
<quest>Having a good attitude about school and work and feeling good about
what you achieve.</quest>
<answer>career wellness</answer>
</question>

I need everything inside the carrots to be highlighted dark gray.


In your example, it would be easiest to highlight everything, and then
remove the highlight from the tags with a wildcard replacement:
Edit > Replace, check "Match wildcards",
Find what: \<*\>
Replace with: ((go to Format > Style > Default Paragraph Font))

\< matches "<", \> matches ">", * matches anything else in between.


If you just want to highlight the innermost tags, you could use a more
advanced wildcard replacement:
Find what: \<([!/\<\>]@\>)[!\<\>]@\</\1
Replace with: ((choose some formatting such as Highlight))
Then with the first wildcard replacement given above, remove the manual
formatting from the tags.

[!/\<\>] matches any character except a slash or angle bracket, [!/\<\>]@
matches any number of them.

\<([!/\<\>]@\>) matches any starting tag such as "<quest>". To reuse a
wildcard expression, you can put brackets around it.
You can reuse the first bracketed expression using the wildcard \1.

So in the example, ([!\<\>]@\>) would match "quest>", and \</\1 would match
"</quest>".

[!\<\>]@ makes sure that the text in between the starting and closing tags
don't contain other tags.


Regards,
Klaus


.



Relevant Pages

  • Re: RichEdit syntax hilighting??
    ... It took about 71.9 seconds to search through the doc and highlight each XML tag blue. ... I am trying to highlight the entire contents of the control. ... So I am just walking the contents looking for the chars, and changing the font color on the value not the tags. ...
    (microsoft.public.win32.programmer.ui)
  • Re: Problem with code in Firefox, works OK in Netscape 7.1
    ... Thank you very much for taking the trouble to reply in such detail. ... has allowed the script to complete, which was the main problem I was ... through the checker at http://validator.w3.org/ didn't highlight any ... but not with the tags). ...
    (comp.lang.javascript)
  • Re: Problem with code in Firefox, works OK in Netscape 7.1
    ... through the checker at http://validator.w3.org/ didn't highlight any ... but not with the tags). ... Stephane Moriaux et son vieux Mac ...
    (comp.lang.javascript)
  • Re: Tag&Rename - adding composer?
    ... spewed forth these words of wisdom: ... >HIGHLIGHT the item. ... IOW, ... Checking a file is used for working with the tags. ...
    (microsoft.public.windowsxp.music)
  • default highlight color in excel 2007
    ... when you highlight a column (for ex: ... and replace) the color is dark gray. ... it has no default color making it hard to locate the correct cell. ... If I don't get an error message, I just have to look on the sheet till I find ...
    (microsoft.public.excel.misc)