You can specify that you want exactly 4 digits after '_K'
my_strings = '1583_pwer_exp_Exxxx_aqxxx_tqx_K2_vxxx_K1001_'
tmp = regexp(my_strings,'(?<=_K)\d{4}', 'match','once');
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!