• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Use grep query to reduce the wording of a promo`x

Community Beginner ,
Mar 16, 2023 Mar 16, 2023

Copy link to clipboard

Copied

Hi everyone,

So I do a promotional catalog once a moth with deals, discounts, and free gifts on just about every page.  The table of contents ends up being used as a kind of cheet sheet for customers, and so over the last year at this job I've managed to set up all my paragraph styles to get the ToC generator to do about 90% of the work of getting it perfect.  I've managed to set up GREP find/change all for $ off, % off, and BOGO, but I'm stuck on the free gift.  Essentially, the way the promo will come on the ToC page looks something like this: 
Free Gift(promo item name)With purchase(# to purchase if more than 1)While Supplies Last(promo item #)

 

The lack of space is intentional.  On the actual ad, they use force line breaks to set up the nested styles to switch from headline, to information, to fine print.  I'm trying to use GREP to change it, but the code is a little more complicated than I have experience with:

Free (promo item name): (promo item #)

 

So essentially, what I'm struggling with is getting rid of "Gift" while keeping the promo item name, then getting rid of the purchase conditions and while supplies last, but keeping the item # (which isn't always just numbers).  Any help would be appreciated.  

TOPICS
How to , Type

Views

146

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
community guidelines
Community Expert ,
Mar 17, 2023 Mar 17, 2023

Copy link to clipboard

Copied

LATEST

You could try the following expression

Free Gift(.*)With purchase.*While Supplies Last(.*)

Now $1 would have promo item name and $2 would have promo item #. So the substitution string would be 

Free $1:$2

See the working sample at the following link

https://regex101.com/r/svkPcA/1

-Manan

 

Votes

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
community guidelines