var string = 'something([findthis(something', result = ( /\[(\w+)\(/.exec( string ) )[1]; alert (result);