Darkstar.Industries
Darkstar.Industries

Reputation: 63

Regex to allow the same word but 32 random characters

This seems so simple but my brain just can't put it all together. I have an end of the URL string which is formatted like this:

CORE65D5B779E35D4F4ABDE327B81725B854

It always starts with CORE and has 32 random characters after.

CORE04F45C975E7D493097634C8AC638D4F9

CORE248C7E54425244D98D7A1CE5587E0E76

CORE65D5B779E35D4F4ABDE327B81725B854

I want to validate to make sure the user inputs this correctly but I can't figure out to do it. So if they add more characters, omit CORE, or paste the entire URL it will error, I just want the above string.

Upvotes: 1

Views: 34

Answers (1)

Marek Puchalski
Marek Puchalski

Reputation: 3659

You have not specified the language you want to have the regex in. For Java you can use CORE[A-Z0-9]{32}. Feel free to play with tools like https://regex101.com/ to check how it would look like for other languages.

Upvotes: 2

Related Questions