Highlighted

Adding commas in a column of numbers in FrameMaker with a regular expression

Community Beginner ,
Dec 05, 2018

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.

Adobe Community Professional
Correct answer by Barb Binder | Adobe Community Professional

Hi ArtistCrystal:

For 4-6 digit strings:

Find: (\d+)(?=(\d\d\d)+\b)

Change to: $1,

~Barb

Views

284

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Adding commas in a column of numbers in FrameMaker with a regular expression

Community Beginner ,
Dec 05, 2018

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.

Adobe Community Professional
Correct answer by Barb Binder | Adobe Community Professional

Hi ArtistCrystal:

For 4-6 digit strings:

Find: (\d+)(?=(\d\d\d)+\b)

Change to: $1,

~Barb

Views

285

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 05, 2018 0
Adobe Community Professional ,
Dec 05, 2018

Copy link to clipboard

Copied

Hi ArtistCrystal:

For 4-6 digit strings:

Find: (\d+)(?=(\d\d\d)+\b)

Change to: $1,

~Barb

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 05, 2018 1
Community Beginner ,
Dec 05, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 05, 2018 2
Adobe Employee ,
Dec 05, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 05, 2018 0
Community Beginner ,
Dec 11, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2018 1
Community Beginner ,
Dec 11, 2018

Copy link to clipboard

Copied

By the way, I added 825 commas in about 2 seconds with that REGEX - amazing and awesome!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2018 1
Adobe Community Professional ,
Dec 11, 2018

Copy link to clipboard

Copied

That makes me happy to hear, Crystal!

~Barb

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2018 0
Adobe Community Professional ,
Dec 06, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 06, 2018 1
Community Beginner ,
Dec 11, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2018 1
Adobe Employee ,
Dec 11, 2018

Copy link to clipboard

Copied

BarbBinder :

—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 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2018 2
Adobe Community Professional ,
Dec 11, 2018

Copy link to clipboard

Copied

What??? Running out now, but can't wait to come back and play.

~Barb

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2018 1
Adobe Employee ,
Dec 11, 2018

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 🙂

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2018 1
Adobe Community Professional ,
Dec 11, 2018

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.

Screen Shot 2018-12-11 at 2.44.43 PM.png

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.

Screen Shot 2018-12-11 at 2.51.35 PM.png

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????

Screen Shot 2018-12-11 at 2.52.02 PM.png

~Barb

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2018 0
Adobe Employee ,
Dec 12, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 12, 2018 0