Grep to find price duplicated?

Adobe Community Professional ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

Any GREP gurus help  me with the following

If the price is 100.00 followed by a tab and 100.00

That's what I want to find

1247.00 \t 1247.00

120.00 \t 120.00

10.00 \t 10.00

etc.

Basically if it's a number followed by two digits separated by a tab with the same number after the tab - that's what I want to find.

Any ideas?

Views

470

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

correct answers 1 Correct answer

LEGEND , Dec 15, 2016 Dec 15, 2016
Hi Eugene,(\d+\.\d{2})\t\1(^/) 

Likes

Translate

Translate
LEGEND ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

Hi Eugene,

(\d+\.\d{2})\t\1

(^/) 

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
community guidelines
Adobe Community Professional ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

Sweet! That was fast!

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
community guidelines
LEGEND ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

That was simple! 

(^/)

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
community guidelines
Adobe Community Professional ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

Obi-wan, what does \1 mean, exactly according to GREP?

Is there a \2 and is there a \3 and is there a \4 and so on?

Mike Witherell

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
community guidelines
LEGEND ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

Hi Michael,

(a)\1 = … = (((((((((a)))))))))\9 = aa

(a)(b)\2 = abb

((a)(b))\2 = aba

\x makes back-reference to an item between parenthesis and its position in the code, and it replicates its contents!

1 … 9 only!

(^/)

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
community guidelines
Adobe Community Professional ,
Dec 16, 2016 Dec 16, 2016

Copy link to clipboard

Copied

Obi-wan Kenobi wrote:

Hi Michael,

(a)\1 = … = (((((((((a)))))))))\9 = aa

(a)(b)\2 = abb

((a)(b))\2 = aba

\x makes back-reference to an item between parenthesis and its position in the code, and it replicates its contents!

1 … 9 only!

(^/)

And as your first and third example are showing nicely \n is counting the opening parentheses from left to right and picks up the contents of the group that is opened by the \n found opening paranthesis:

(((a)(b)(c))(d))\1 = abcdabcd

(((a)(b)(c))(d))\2 = abcdabc
(((a)(b)(c))(d))\3 = abcda

(((a)(b)(c))(d))\4 = abcdb

(((a)(b)(c))(d))\5 = abcdc

(((a)(b)(c))(d))\6 = abcdd

If we go on with counting up \n nothing will be found, because there are not enough opening parantheses in my expression.

(((a)(b)(c))(d))\7 ≠


I wish there would be an error message saying:

"Error: There are only 6 opening parantheses in your expression!"

But instead the message is saying "No match found".

Regards,

Uwe

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
community guidelines
Adobe Community Professional ,
Dec 18, 2016 Dec 18, 2016

Copy link to clipboard

Copied

LATEST

I was nearly there I could not get the repay to work when a Tab was involved,. I understand my error now and it was a while since I did Any grep.

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
community guidelines
Adobe Community Professional ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

Thank you Obi-wan; I didn't know that. I will add it to my GREP reference sheet:

http://trainingonsite.com/images/downloads/indesign_cc_2015_grep_codes.pdf

Mike Witherell

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