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

Grep to find price duplicated?

Community Expert ,
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

816

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

(^/) 

Votes

Translate

Translate
LEGEND ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

Hi Eugene,

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

(^/) 

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
Community Expert ,
Dec 15, 2016 Dec 15, 2016

Copy link to clipboard

Copied

Sweet! That was fast!

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

Copy link to clipboard

Copied

That was simple! 

(^/)

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
Community Expert ,
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

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

(^/)

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
Community Expert ,
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

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
Community Expert ,
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.

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
Community Expert ,
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

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