Quote:
Originally Posted by Jade Aislin
I had hoped that the first line would add (Friendship) to the end of the tag, instead it replaced the &. I also found at least one name in the pairing being deleted, although I haven't checked the rest of my code to find out why.
|
Only the part that matches the regex is replaced. If you want to add something to the end, you'll need to match the rest of the string. Something like this should work:
ships=>( )?(&|and)(.*?)$=>\1 \3 (Friendship)
Quote:
Originally Posted by Jade Aislin
On another note, I ran into a couple errors when trying to download stories, unmatched group and invalid group reference. I'm not sure why I received these error. I didn't see any obvious similarity in the stories when I checked. Although one of the stories had the '|' in one of the fandoms that seabream mentioned. Is it a problem in my code somewhere? If so what should I be looking for?
|
There is a
known issue(look for "Brief explanation") with python's regex library not handling group matching the same as everybody else.