On 11/11/2011, at 04:10 , John Gold wrote: > Question -- Now that you've laid it out, I understand what the > expression does, except for the \1 at the end of the search pattern. > What does that do?
You're asking about deepest darkest tech magic. I could tell you, but then I'd have to shoot you :) But seriously … The short answer is that "^(\d+)(.*)\r\1" contains two matching sets: (\d+) and (.*). In regexes you can refer to matched sets using \1 through \9. So after the regex has matched everything but the \1, the engine now has two value it's looking for. In this case \1 is the number before the tab (matched using \d+ meaning "one or more digits"). The long answer is: pick up "Mastering Regular Expressions" from O'Reilly Press. It's a must-have reference. Find it here: http://shop.oreilly.com/product/9780596528126.do?green=20956246-2551-5FD2-AF0B-2D7849E2B360&cmp=af-mybuy-9780596528126.IP Regards Alex PS: strictly speaking, I wouldn't need to shoot you since you'll either end up being a deepest darkest tech wizard yourself, or your head will spontaneously explode from trying to grok regexes.
smime.p7s
Description: S/MIME cryptographic signature
