Copy link to clipboard
Copied
Does anyone have a regular expression for how to add a comma to a column(s) of numbers in FrameMaker? The columns are 4, 5, and 6 digits mixed.
Hi ArtistCrystal:
For 4-6 digit strings:
Find: (\d+)(?=(\d\d\d)+\b)
Change to: $1,
~Barb
Copy link to clipboard
Copied
Hi ArtistCrystal:
For 4-6 digit strings:
Find: (\d+)(?=(\d\d\d)+\b)
Change to: $1,
~Barb
Copy link to clipboard
Copied
Whew hooo, thank you Barb! I just added 825 commas in about two seconds! Now I'm excited to learn more about regular expressions. Thanks again.
Copy link to clipboard
Copied
You might also want to have a look at this blog post on the Adobe TechComm blog about regular expressions. It gives a good start, I think.
Copy link to clipboard
Copied
Good morning Stefan,
thank you for the blog post suggestion - I have it and the book recommended by Barb; you folks are awesome!
Crystal
Copy link to clipboard
Copied
By the way, I added 825 commas in about 2 seconds with that REGEX - amazing and awesome!!
Copy link to clipboard
Copied
That makes me happy to hear, Crystal!
~Barb
Copy link to clipboard
Copied
Right? I love regular expressions! They dramatically cut down on the time it takes to clean up files.
In addition to the resource that Stefan linked to, I also recommend checking out this book from regular forum contributor Peter Kahrel: Shop: InDesignSecrets. Yes, it is geared towards an InDesign user—and FrameMaker does not yet support GREP styles—but REGEX is REGEX and the information in this guide is invaluable. And the focus is on writing expressions that are specifically used to clean up documents for publishing.
And since Stefan is on this thread, I’m going to take a moment to remind him that I think it is really important that we add the ability to save our REGEX in a menu with descriptive names so that we can access them easily the next time we need them. FrameMaker does remember the last 10 expressions (10 for Find and 10 for Change) but when you perform additional find and change activities, they drop off the bottom of the list. I guess the bright side is that I’m getting much more efficient at writing the expressions that I need because I have to keep re-keying them in.
~Barb
Copy link to clipboard
Copied
good morning Barb,
Thank you for the REGEX and for the book suggestion. I have ordered the book and downloaded the PDF - just haven't had time to look at it yet I also have the information from the blog post recommended by Stefan. Have a great week.
Crystal
Copy link to clipboard
Copied
—and FrameMaker does not yet support GREP styles—
… I have good news for you 🙂
Have a look at the maker.ini:
[Preferences]
(….)
;Regular Expression Syntax preference.Options are "egrep", "grep", "Perl".
RegularExpressionSyntax=Perl
The default is perl (as per discussion some years ago in the beta release community).
But you can change it to grep ("Global Regular Expressions Print" – like in InDesign), or even egrep (Extended Global Regular Expressions Print), aka grep -E.
Enjoy 🙂
Copy link to clipboard
Copied
What??? Running out now, but can't wait to come back and play.
~Barb
Copy link to clipboard
Copied
BarbBinder wrote
And since Stefan is on this thread, I’m going to take a moment to remind him that I think it is really important that we add the ability to save our REGEX in a menu with descriptive names so that we can access them easily the next time we need them. FrameMaker does remember the last 10 expressions (10 for Find and 10 for Change) but when you perform additional find and change activities, they drop off the bottom of the list.
Yes, BarbBinder. This is on my fav list for new features as well. We already have a ticket for this 🙂
Copy link to clipboard
Copied
I'm so excited for the saved GREP queries but I'm wondering if we have different definitions for GREP styles, Stefan. I read about differences between grep, egrep (and fgrep) but what I'm talking about is being able to assign character styles via GREP. Not through Find/Change which we can do now, but more like nesting a character tag in the auto-numbering of a paragraph tag, so that it is dynamic.
For example, in InDesign, I might have a paragraph with prices.
I can define a GREP style to watch the paragraph and format it dynamically. This one superscripts the digits after a decimal point and is nested within the paragraph tag definition.
What makes GREP styles different from Find/Change is that if I edit that final price to add a decimal point and two digits, they superscript themselves as I type—I don't have to run (or more likely, forget to run) another Find/Change. Is that coming to FrameMaker????
~Barb
Copy link to clipboard
Copied
Hi Barb,
sorry, I thought with “GREP Style” you would just mean support for GREP in Find/Change as another regex flavor.
GREP styles like in InDesign are not supported in FM. Theres has not been much interest in this in the TechComm community until now (and even in InDesign I have not seen many people actually using it).
Maybe you can create a feature request ticket in Tracker for it? If enough people vote for it it might make sense to put look closer into it.
Cheers,
Stefan