You can use split
"20_hbeu50272359_402_21".split('_')[1]
The above splits your string based on the _ char, then use [1] to select the part you want (in the returned array or ["20", "hbeu50272359", "402", "21"])
This of course would asume that your strings always follow the same format. if not you could use a regEx match with what appears to be a prefix of hbeu. Something like /(hbeu[0-9]+)/ But I'd need more info to give a better approach to the split method
UPDATE:
based on your update you could do a regex match like:
var stuffWeWant = "20_hbeu50272359_402_21".match(/(hbeu[0-9]+)/)[0];
// this will work regardless of the string before and after hbeu50272359.
*is greedy..var s = '20_hbeu50272359_402_21'; /_([^_]+)_/.exec(s)[1];