I need a regular expression that matches all numbers that are surrounded by <@! or <@ and >. The matches must not follow an odd number of backslashes but can follow a zero or even number of backslashes.
Currently, I have this regex:
(?<!\\)(?:\\{2})*(<@!|<@)[0-9]+>
The problem is that the matches include the backslashes and I need a regular expression that does not include the backslashes.
Can anyone make a regular expression that can accomplish this?
Examples:
Valid Input String: \\<@!123>
Matches: <@!123>
Invalid Input String: \\\<@!123>
Matches: none
Valid Input String: <@123>test<@456>
Matches: <@123>, <@456>
Invalid Input String: \<@123>test\\\<@456>
Matches: none