Copy link to clipboard
Copied
CC on a Mac.
I have a large document with many "dictionary" definitions, like this:
apple * a common fruit
blue bonnet * the state flower of Texas
bird of paradise * a spectacular tropical bird species
Is there a way I could use search and replace to apply a character style to the beginning of each paragraph, to all the characters to the left of the asterisk?
MarieMeyer wrote:
apple * a common fruit
blue bonnet * the state flower of Texas
bird of paradise * a spectacular tropical bird species
Is there a way I could use search and replace to apply a character style to the beginning of each paragraph, to all the characters to the left of the asterisk?
Answering your question as written—apply a character style to all characters to the left of the asterisk—the nested styles will work fine. If an asterisk (the trigger) isn't there, the character style will ap
...Copy link to clipboard
Copied
Use nested styles in paragraph style instaed of find and replace
I used Your style as character style.. create your own
Copy link to clipboard
Copied
Hi,
Use a grep style: ^.+?(?=\*)
(^/)
Copy link to clipboard
Copied
HI Obi.. grep will work but if i added some new text after find and replace done.. it wont change.. so adding in style will be give advantage
Copy link to clipboard
Copied
Hi tpk1982​,
Obi-wan Kenobi​ said grep style (in paragraph style) and not Grep (search and replace)
A grep style will work in the same as a nested style.
There are only one thing: The question if repeats (more than one asterisks) exists in the document.
Have fun
Copy link to clipboard
Copied
Sorry for the oversight.. yes i aware about grep style
Copy link to clipboard
Copied
The problem with a nested style here is that you need to have an *! 😉
(^/)
Copy link to clipboard
Copied
Why that is a problem?
Copy link to clipboard
Copied
… Hi Bob!
Because, here, on Tatooine, Sith Nested Styles work badly!
(^/)
Copy link to clipboard
Copied
Yes but anyhow he need to apply those character style only (s)he have *
Copy link to clipboard
Copied
Not a good kind of view!
The para style is applied everywhere and if there's an asterisk, the char style is applied without doing anything else! … or maybe a coffee!
(^/)
Copy link to clipboard
Copied
MarieMeyer wrote:
apple * a common fruit
blue bonnet * the state flower of Texas
bird of paradise * a spectacular tropical bird species
Is there a way I could use search and replace to apply a character style to the beginning of each paragraph, to all the characters to the left of the asterisk?
Answering your question as written—apply a character style to all characters to the left of the asterisk—the nested styles will work fine. If an asterisk (the trigger) isn't there, the character style will apply to the entire paragraph. As soon as you add it, it will work again.
This works pretty well here on the planet Earth.
Copy link to clipboard
Copied
You don't think as Jedis!
You say: If I've an asterisk, I'll take what before and, if not, I'll take all!
A Jedi will simply do as follows: … if not, he goes away! …
(^/)
Copy link to clipboard
Copied
Don't go away, Obi-wan Kenobi —we will use GREP. Who said anything about Nested Styles?
I just remembered that we are back from out of town and I need to return to your puzzle!
Copy link to clipboard
Copied
I agree! A very useful "correct" answer! A para style to apply … only if you have an asterisk!
So, yes! it's a "correct" answer! The total and definitive justification of style application! …
(^/)