После комментария @bobble Buble
Я думаю, что это будет работать:
\w{12,16}
Демо
Также вы можете использовать границы слов, если высоответствие должно быть словом.
\b\w{12,16}\b
Демо:
Обновлено после @PeterM Комментарий:
Последняя версия более многословна, но более точна:
string=`Johannsonoff 111111111111111 05FK3NEK900058Vf 05FK3NEK900058Vfaf48 hello my SNO is fFK3NEK9000515 05FK3NEK9000515 please add it 05FK3NEK900058Vfaf48 faf fasf1654 EK90058Vs11 EK9005f8Vs12 05FK3NE90058Vs16 05FK3NEK90058Vs17`;
// Returns an Array in which elements are strings between 12 and 16 characters.
const groupMathed = string.match(/\b\w{12,16}\b/g)
// Returns the first element that have a digit [0-9] follow by a alphabetic character or a alphabetic character followed by a digit.
const alphanumericWord = groupMathed.find(e => /[0-9]+[a-zA-z]+|[a-zA-z]+[0-9]+/.test(e))
console.log(alphanumericWord)
Другим подходом может быть использование этого регулярного выражения, более подробного, но уменьшающего код :
(?=(\b\d+[a-zA-Z]|\b[a-zA-Z]\d+))[a-zA-Z0-9]{12,16}\b
Демонстрация: https://regex101.com/r/0lMyoV/11/
string=`asdfghjlqerut hello my SNO is 1234567891234 05FK3NEK900058V 0FK3NEK900058V asdfasfd25fasfaa please add it 05FK3NEK900058Vfaf48 faf fasf1654 F0K3NEK900058V Johannsonoff 111111111111111 05FK3NEK900058Vf 05FK3NEK900058Vfaf48 hello my SNO is fFK3NEK9000515 05FK3NEK9000515 please add it 05FK3NEK900058Vfaf48 faf fasf1654 EK90058Vs11 EK9005f8Vs12 05FK3NE90058Vs16 05FK3NEK90058Vs17 05FK3NEK900058Vfaf48`;
const regex = /(?=(\b\d+[a-zA-Z]|\b[a-zA-Z]\d+))[a-zA-Z0-9]{12,16}\b/g
const groupMathed = string.match(regex)
console.log(groupMathed)