Decode with REGEX

I understand that REGEX can be used to encode inputs.
Can the same REGEX be used to decode?

Encoded Password = P.:star:[WORD]
REGEX = (SU|MM|E|R):star:

(Asterisk does not show, so I am using emoji :star:)

What would be the original password?

it is looking for SU or MM or E or R
In the encoded password the only valid answer will be ‘R’.
Am I right?

I’m really not sure that regex can be used for encoding. Regex is used for matching patterns in the text. Regex /(SU|MM|E|R)/ will indeed look for “SU”, “MM”, “E” or “R” in the text, whatever it finds first.

It’s alright.
I have resolved the issue.

Thanks for the respond.
Please close Case.