View Single Post
Old 05-06-2013, 10:06 PM   #1362
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,317
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Quote:
Originally Posted by Jade Aislin View Post
While I was looking up the reference you gave me, the 'unmatched group' seemed to resolve itself. However, I am still getting the 'invalid group reference'. I tried looking it up and it looked like it might be a problem with '$' when not used as an end of string reference. As far as I know my code only uses the $ to indicate the end of the string I want. Is that the only reason I would get that error?
The "unmatched group" issue is caused when a paren grouping is skipped, but used in the replacement. (Perl, etc automatically provide an empty string in that case.) "(a)?a" will match "a", but a replacement to "\1b" will fail. So we use "(|a)a" instead, which makes the paren group empty, but not skipped.

The "invalid group reference" is more basic--you're using \3 meaning the third paren group, but you only have 2 paren groups. Change it to \2.
JimmXinu is offline