Copy link to clipboard
Copied
Im looking to be able to add a 3 digit number in front of any 6 digit number that i find for example 380005 becomes 12538005 and 690567 becomes 125690567 and so on.
I have this as the find
(\d\d\d\d\d\d)
But am struggling to find a style that will say place 125 or whatever the 3 digit code is in front of the 6 that i have.
Any help appreciated
Copy link to clipboard
Copied
You can't with a Grep style!
Try a F/R:
Find: \b\d{6}\b
Replace by: 125$0
(^/)
Copy link to clipboard
Copied
Just got the answer to this and apparently you can. I think this is basically doing the same thing that you have outlined the $1 refers to the bracketed six digits
(\d\d\d\d\d\d)
125$1
Copy link to clipboard
Copied
Not exactly the same!
try with: 0123456789
… and the parenthesis aren't not useful if not other group(s)!
Think simple and global! (even if you don't need it!)
(^/)
Copy link to clipboard
Copied
Backbone22 wrote
Just got the answer to this and apparently you can.
No you cannot. A GREP style can only apply formatting to a text, found with a GREP. See the online help: Drop caps and nested styles in InDesign
Copy link to clipboard
Copied
You say GREP style, which is why the answers above say you can't do it. You can't do this as a GREP style within a paragraph style. Or did you just generally mean a GREP expression?
To clarify, you can only (as Jongware stated) apply formatting via a character style to text found with GREP style in a paragraph style. If you need to add, subtract, re-arrange, or otherwise modify the found text, then you need to use the Find/Change dialog box...which is where you would need to work for your needs here.
Copy link to clipboard
Copied
I guess i meant Grep expression as i used the Grep function in the Find/Change dialog box which worked for me.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now