I'm trying to replace a character NOT AT THE START OF THE STRING, with itself followed by another character, using regexKitLite.
thisPlate = [sBasePlate
stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"([^\\^]%@)", thisChar]
withString:[NSString stringWithFormat:@"\1%@", thisRep]
];
If sBasePlate is "temp", then thisPlate gets set to emp, but I'm expecting it to be teemp
So I'm trying to replace NOT THE START OF THE STRING, followed by thisChar, with that which has been matched followed by thisRep.
Have I got my backreferences wrong? Because that's what seems to be missing. It's adding in thisRep, but ignoring the initial match and not putting it back in with \1
Sorry if I've done something really stupid and obvious, this is my first app.