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?
Hi Eugene,
(\d+\.\d{2})\t\1
(^/)
Copy link to clipboard
Copied
Hi Eugene,
(\d+\.\d{2})\t\1
(^/)
Copy link to clipboard
Copied
Sweet! That was fast!
Copy link to clipboard
Copied
That was simple!
(^/)
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?
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!
(^/)
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
Copy link to clipboard
Copied
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.
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