Copy link to clipboard
Copied
Hi there. I've used a few tasty GREP expressions that the good folk of this community have helped with over the years, but I must confess I've never grasped it well enough to improvise or create my own...
I'm working through a long list of text and have a line of new prices for products in a specific style (let's call it NOW price). I'd like to insert the text 'Now only' at the start of all of these rows. Previously I've added that as bullet text which works a treat on it's own row, but as soon as I place this text onto a new line that will disappear so it needs to be the actual wording 'NOW ONLY' like below.
Currently (prices all differ so just an example and there are other prices in the document so I'll apply it only to the style in question):
£29.99
Should be:
NOW ONLY £29.99
Well the bullet should be paragraph style - so that when the text moves to the next line it should retain the style of the paragraph style.
But if you're looking to put in NOW ONLY at the start then
Find
^(?=£[\d,\.])+
change to
NOW ONLY
(with a space at the end)
Any price at beginning of a sentence will update
£29.99
£2,999
£2,999.99
this is the part that catches the price after a £
£[\d,\.]+
^ is th start of a sentence
And wrapping it in
(?=) means it will ignore it
So
...Copy link to clipboard
Copied
Well the bullet should be paragraph style - so that when the text moves to the next line it should retain the style of the paragraph style.
But if you're looking to put in NOW ONLY at the start then
Find
^(?=£[\d,\.])+
change to
NOW ONLY
(with a space at the end)
Any price at beginning of a sentence will update
£29.99
£2,999
£2,999.99
this is the part that catches the price after a £
£[\d,\.]+
^ is th start of a sentence
And wrapping it in
(?=) means it will ignore it
So effectively, it finds the price and ignores and inserts the text insertion at the beginning
^(?=£[\d,\.])+
The + means just match longest string
even if it is
£2,999,999,999,999.99
Copy link to clipboard
Copied
Magic! Thank you Eugene. 🙂
Find more inspiration, events, and resources on the new Adobe Community
Explore Now