Copy link to clipboard
Copied
I opened an older Indesign file that including a GREP style for numbers. Everything had worked perfectly fine in the older version of Indesign, but for some reason, it's now ignoring the commas in the number.
What changed? And how do I get this fixed?
Thanks!
dcroatt wrote
I can't remember how I got the expression.
regex \d+ is the default ID offers when you create New GREP Style, so no need to 'get' it somehow, it’s always here. It finds one or more digits in a row. It isn't able to catch commas, and never was.
Regarding your query, there is more than one approach to achieve it, depending on actual content.
You can start with this:
\d+,\d+
Ah, numbers 'without comma', most likely, should be included, too?
Then, maybe:
\d+,?\d+
or
\b\d+,?\d*
or, even simpler
\d
...Copy link to clipboard
Copied
As you say, the only thing that changed should be your ID version and nothing else. Or at least, nothing doing anything with GREP styles.
What GREP expression do you have? Can you post a screenshot showing where it does not work?
Copy link to clipboard
Copied
The expression is:
/d+
Copy link to clipboard
Copied
That cannot be true. That is not a valid GREP expression (at least not for picking up digits), and it does nothing to a comma.
So it could not have worked in the old file either. Maybe someone applied the character style manually to your comma's.
Copy link to clipboard
Copied
Which Paragraph style was used before and which Paragraph style is being used now? It might be that the wrong Paragraph style (that includes the GREP) has been applied to the text.
Copy link to clipboard
Copied
Hi dcroatt:
Was that a typo? To target up one or more digits, you would use \d+. (A backslash not a forward slash.) But as [Jongware] said, this would match digits, but not commas.
Can you explain what you need moving forward? I'm guessing it's formatting digits, with or without a comma, but showing us examples makes it easier to help.
~Barb
Copy link to clipboard
Copied
BarbBinder wrote
Was that a typo? To target up one or more digits, you would use \d+.
Good catch!
Copy link to clipboard
Copied
Thanks everyone! BarbBinder, you were right, it was indeed a typo. The expression I'm now using is \d+
It's working perfectly fine for all digits. Except it used to apply the style to the comma in a number like "1,500" — and now it doesn't include the comma. I'm pretty sure it did indeed work before with that expression, and I didn't have to add in the character style to the comma separately. (And [Jongware] there's isn't anyone else, so nobody else to applied the style either.)
But seriously, it doesn't matter if it worked before. Maybe I had the expression right before and the expression itself changed. It was so long ago that I can't remember how I got the expression. I just no I didn't have any problems when I did this project last year, and opening the file this year, boom, problem.
Anyway, all I need from anyone who is willing to help is an expression that would include the commas for numbers over 999, and not other commas. If you know how to do this, I'd appreciate it so much!
Thanks!
Copy link to clipboard
Copied
dcroatt wrote
I can't remember how I got the expression.
regex \d+ is the default ID offers when you create New GREP Style, so no need to 'get' it somehow, it’s always here. It finds one or more digits in a row. It isn't able to catch commas, and never was.
Regarding your query, there is more than one approach to achieve it, depending on actual content.
You can start with this:
\d+,\d+
Ah, numbers 'without comma', most likely, should be included, too?
Then, maybe:
\d+,?\d+
or
\b\d+,?\d*
or, even simpler
\d+,?
Copy link to clipboard
Copied
Yes, thank you winterm! That is perfect. Clearly I did something, or some glitch happened that reverted the GREP to the default. Your suggestions worked perfectly. Thanks!