I'd like to create a regex for a passcode where users signify their number is a passcode with words and a double colon before the code or a hash after the word. So I'd like both of the following to be accepted:
code: 1234567
123567#
However as '#' and 'code: ' are at opposite ends of the pattern my current way of doing this is repeating my entire regex twice as follows.
(?:(?:code|pc|#|participant)[:>]?#?(\\d{7,8}(?!\\d)))|((?<!\\d)\\d{7,8})#
I'm essentially saying prefix words + passcode OR passcode + #
When I'd like to say prefix words OR a hash at the end + passcode. Is the latter possible?