Regex for string *11F23H3*: Start and end with *, 7 Uppercase literals or numbers in between

Viewed 26

I need to check strings like *11F23H3* that start and end with a *and have 7 uppercase literals or numbers in between. So far I have:

if (!barcode.match('[*A-Z0-9*]')) {
  console.error(`ERROR: Barcode not valid`);
  process.exitCode = 1;    
}

But this does not cover strings like *11111111111*. How would the correct regex look like?

1 Answers
Related