I need to match the occurrence of a character before a string. The string might occur multiple times, meaning the character might change.
Test subject:
§aUsername: Message, which happens to contain Username. §3Wow, Username again.
I would want three groups, because Username occurs three times in the subject.
Desired output:
["Username", 'a']
["Username", 'a']
["Username", '3']
I wrote this regex, but it only works with one occurance of Username.
My (failed) attempt:
§(.).*?Username
Edit: That regex entirely ignores the second occurence of Username, which should match the same character (a) as the first one.
Its output:
["Username", 'a']
["Username", '3']