If you want to target the whole paragraph, use this:
^.+No class \d.+
The caret stands for "beginning of paragraph". Not sure iof this is what you want, though.
Thank you so much for your suggestion. I'm targeting one sentence within a paragraph, and the paragraph has one or more sentences of text before, and text after, the sentence that I need to work with. Is this possile?
Probably, but the difficulty is how you define "sentence". Maybe "a string of characters from an upper-case letter up to a full stop, where the upper-case letter is either the first letter in a paragraph or preceded by a full stop and a space"?
(?<=\.\s)? //full stop followed by a space. ? catches first sentence in paragraph
\u.+No class\s\d //upper-case letter (\u) followed by one or more characters (.+), followed by "No class" followed by a space (\s)
.+(?=\.) // one or more characters (.+) followed by a full stop (\.).
The final full stop must be in a lookahead, otherwise you find every other sentence instead of every sentence.This fails if there are periods between "No class [dates]" and the end of the sentence.But your two examples are followed by a full stop: if that's always sentence-final, then you could use this:
Probably needs some more tweaking though.
The paragraph needs to look like this:
This is one example. I have many such paragraphs to work with throughout the catalog. The number of sentences before the date paragraph varies. The date itself varies because sometimes it's something like 7/11 and sometimes it's something like 7/11-7/18. The bold instructor name is done with a nested style that triggers on an en space. I could do the italic date using a nested style, but didn't want the hassle of putting in a special character to trigger the change to italic. (Don't like the hassle of triggering the bold instructor name with a special character either, but that's the only way I could figure out to do it.)
If I use this:
The text following the date sentence also takes on the italic character format.
If I use
The text before the date paragraph becomes italic.
I think I'm slowly beginning to understand. So you have paragraphs that (may) end in "No class . . . Instructor: . . ." Here's another shot:
No class\s[-\d/]+ // Match "No class" followed by a space, then by one or more hyphen, digit, slash.
To bold from Instructor to the end of the paragraph, you could use this:
(Though the $ isn't striclty necessary.)
I so much appreciate your help with this. Your explanation makes it understandable. But there is still a mystery.
The GREP for Instructor: Instructor Name works fine. The GREP for the date sentence is not working. Instead of the date sentence becoming italic, it matches the first part of the paragraph. This is what the GREP looks like:
This is what the paragraph looks like with the GREP applied:
It should look like this:
In a separate issue in another paragraph, which is a heading paragraph, I have a similar situation. The headings are bold, some headings list ages, and some list ages AND whether parental participation is required. I thought I could extrapolate from the information you've given me to fix this paragraph as well. I've tried different combinations, but so far haven't gotten it to work. The paragraph looks like this:
But it needs to look like this (bold paragraph with ages in regular,and parent requirement in italic):
The heading doesn't always have an age requirement, and doesn't always require parental participation.
The catalog is quite long, so if there is a way to fix these two types of paragraphs, it would save a ton of time.
the date part of the grep code should just be
1 person found this helpful
[\d.]+[-My,]+that should catch your possible months to years string including the commaand you can just use the exact string 'requires parent participation' for the last part.
The first grep expression in your screenshot doesn't work because you added //, which I should have mentioned should be left out (including any preceding spaces) -- sorry about that. It should read just this:
The hyphen is needed to match dates like 7/11-8/11.
As to the headings with dates and optional parental guidance, this one works on your example:
which is a bit safer than Reese's because it requires that the date ends in M or y. The ? following (, requires) makes the parenthetical optional. Remember that grep is case-sensitive: if your months can be lower-case m as well, use [-\d\.Mmy] for your character class. You may need to tighten up the grep to match dates depending on the possible formats.
Thanks for your help on this. I got so wound up in just meeting deadlines that I didn't have a chance to get back to you until now.