pretty much, I have these codes, and they can be of the following two forms, (where a represents any letter):

aa* or a*a

So now, I know how to do pattern matching and I could do something like (/\w{2}\*/) - this would match the first type. However, I'm confused how to get the second type. I can't do (/\w\*\w/) because this would match a*b, or b*c, or g*l, or anything like that. The issue is the first and second letter must be the same. So, b*b is all right, z*z is all right, etc.

Edit: Think I figured it out! There is something in perl called pattern memory. I have done this:

One other thing...escaping things in regexes makes them very hard to read. One trick is to put the character inside a character class. Inside a character class, the special regex characters lose their special meaning. Also, using some whitespace to separate the parts of your regex (coupled with the x modifier) will make your regexes easier to read: