Copy link to clipboard
Copied
I need to create running headers from the first instances of Bible reference on each page of a book I'm working on. The trick is that I don't want to include any dashes or semicolons or anything after them in my running header. In the case of the screenshot example, I would want my running head to just read "Matthew 1:30". I'm assuming this is going to take a grep style, but admittedly my grep coding skills aren't very good. If someone could point me to the solution it would be much appreciated! After solving this, I will need to do the same with the last reference on right-hand pages.
And some more testing...
Part of the problem seems to be the .+, so I've changed that to \w+ and the \s seems to be the other problem, so I've changed that to a typed space, so the new expression, whch seems to work now, is ^(\w+? )+\d+:\d+
Copy link to clipboard
Copied
Try using this expresion to assign a GREP style:
^(.+?\s)+\d+:\d+
It should find any one or more words at the start of a paragraph followed by a space and then any number of digits a colon and more digits.
Copy link to clipboard
Copied
Thanks for your help. I don't know why that's not working for me.
Copy link to clipboard
Copied
What happens when you try it?
Copy link to clipboard
Copied
When I try it in Find/Change, it just says "cannnot find match".
Copy link to clipboard
Copied
Are you sure you're in the GREP tab? Not set to find in a selection? It worked OK in my test...
Copy link to clipboard
Copied
And did you try it as a GREP Style? You can create a character style that has only a name, no attributes, to use to set up the variable.
Copy link to clipboard
Copied
Yeah, I did change the visual appearance of the style just for testing purposes. No go.
Copy link to clipboard
Copied
positive
Copy link to clipboard
Copied
Can you post a screen capture of the Find/Change dialog, please.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
OK, this is REALLY wierd.
I did some more testing in both CS6 and in CC 2021 which both happen to be open at the moment on my machine. In both cases the GREP works if there is a single paragraph in the story using Find/Change, but not if there are multiple paragraphs, and as a GREP style it works for the first three of 4 in CS6, but only the first two in CC 2021.
I'd like to hear from some of the GREP experts...
Copy link to clipboard
Copied
And some more testing...
Part of the problem seems to be the .+, so I've changed that to \w+ and the \s seems to be the other problem, so I've changed that to a typed space, so the new expression, whch seems to work now, is ^(\w+? )+\d+:\d+
Copy link to clipboard
Copied
You're a genious, Peter! Thanks!
Copy link to clipboard
Copied
Now if I could just get it to apply to my running header variable... Doesn't seem to want to work.
Copy link to clipboard
Copied
Someone else posted a couple years ago that you can't use grep styles in a running header like that. I'm guessing that hasn't changed. Too bad. I guess it would have to be done via find/change after flowing the full document.
Copy link to clipboard
Copied
Ah yes. GREP styles don't show up as character styles directly. You'll have to use Find/Change to assign the style, but as I said earlier, you can create that style as just a name so it doesn't affect the formatting in your body text.
If you need to format the whole biblical reference as italic, which seems to be the case, I think you'll need to do THAT part as a GREP style (essentially the reverse of what's intuitive here). I think you can use ^.+\d to do that
Copy link to clipboard
Copied
Now you're thinking ahead of where I'm even at with the project! Good stuff. I don't know yet if I'll need to format the references separately, but there's a high likelyhood I will. Thanks again for all your help.
Copy link to clipboard
Copied
You're welcome. This one was a lot of fun.
Copy link to clipboard
Copied
Taking a look at the sample screenshot:
^\w+[\h\d:;-]+\d
(^/) The Jedi