Adobe InDesign CS4 contains a couple of powerful enhancements to Paragraph Styles. In addition to Nested Styles, CS4 enables you to apply character level styling on a line-by-line basis within a paragraph, or using GREP to identify and style runs of text. For example, you can use a GREP Style to automatically italicize any URL that appears in your text.
Here is the UI for Line Styles and GREP Styles:
These features give rise to a practical question: if a nested style, line style, and/or GREP style overlap, which formatting gets priority?
According to the composition engineer:
There can be ranges of text that have overlapping character styles
applied using GREP styles, line styles & nested styles all interacting.
If the style definitions don’t clash, they will ALL apply. For example,
if the first line is all-caps (line styles), and the first word is bold
(nested styles), then the first word will be both all-caps & bold.
Pretty trivial example, but they can stack. In the case where there is
a clash, the choice is pretty fixed:
Line-styles are lowest priority
Nested Styles are next
GREP styles are top priority
If you have multiple GREP expressions that match the same text, then the
styles will still stack, and the order of the expressions in the dialog