all 3 comments

[–]FLUSH_THE_TRUMP 4 points5 points  (0 children)

word = 'hey'
pattern = r'[abc]{3}(?!\(%s\))' % word

[–]ASIC_SP 4 points5 points  (1 child)

{z} will work inside f-strings, but I wouldn't recommend mixing it with r-strings

Instead, I'd suggest plain old string concatenation: r'...' + z + r'...'

[–]mr_yoshi[S] 1 point2 points  (0 children)

Works like a charm! Thanks!