I think there's an old thread about this someplace, but here's where I think you are going wrong.
You don't need to apply any style to the space, so there's no need to find it at all. Nor do you want to apply a style to the slash. Instead you want to use look behind and lookahead.
For the numerator find (?>=\|)\d+(?=/) You don't really need both the lookahead and the look behind, but you need at least one of them, and without the lookbehind you could be formatting dates.
For the denominator (?>=/)d+ Unfortunately I can't think of a way that this won't affect dates, so the lookbehind above may be moot, and you need to be careful that you don't actually have any dates in the paragraphs that have this style.
I suppose you could add one more GREP style /\d+/\d+ to find any three-part dates and apply character style none to fix them, but it won't help for dates with only one slash. Maybe one of the real GREP experts has a better idea.
Will find fractions, but not dates.
yes, I've searched everywhere,but couldn't find. I've played with the look behind/forward but couldn't quite get it to work.
So I copied & pasted (?>=\|)\d+(?=/) against my Numerator character style and (?>=/)d+ for my denominator style and I got no changes-am I missing something?
Thanks for this, it does successfully find the unformatted fractions in the find/grep dialogue box. This will be handy to run at the end of a document - do you not know of a way to build it into a paragraph style?
Hmm having a hard time imagining what it is you're tyring to do?
Can you simplify the process..
Eugene, the problem is that the font in question does not have a Fractions alternate, so you can't find numereator and denominator at the same time and make the change.
Sorry, I posted without testing and used the wrong metacharacter for the lookbehind. That expression should be (?<=~< )\d+(?=/) if you are looking for a thin space.
Seems I also left out a backslash in the expression for denominators, which should be (?<=/)\d+
The date-finder expression works, though.
The correct formatting of the quotation mark would be a bonus, but I'd happily settle with just the fraction bit....:-)
How did you want the quotation mark formatted? If you mean to use a doouble straight quote instead of curly typographers quote, I don't think that can be done with a style so you'd need to run a find/change.
Eugene Tyson wrote:
Just need another one for the dates
*edit sub "roman" char style for "no script" in Character Style name
Set the Position to "Normal" in the dates "no script" character style.
(i called it roman in mine but technically this should only be for text with roman style, i.e., no bold or italics)
I think here you really want to apply [None] so the text in the date takes on the underlying basic formatting defined in the paragraph style. And as I said this only works for month/day/year or day/month/year constructs. I can't think of a way to differentiate a day/month or month/day from a legitimate fraction, except perhaps with a negative lookbehind for that thin space, which would mean that all fractions would need to have thin spaces, even if they have no integer component, and you'd need one more grep style, and as it turns out in my just now attempted test it doesn't seem to work anyway. I can't get it to not find fractions if they have more than one digit in the numerator...
Perhaps - in that case change the date naming convention to something else lol.
There's only so much a GREP search can do.
Sometimes users expect the unreasonable, and it's important to point out, I think, that when you are using GREP you are looking for a pattern, and that pattern mightnot be restricted to just the text you want to change, so you might be building in som unwanted changes at the same time. Computers are a lot dumber than they seem, but very cooperative. They just do what they are told.