The problem

I was not able to paste structured messages into the form of my bank because it used multiple inputfields which would not detect what I was pasting. I made a little bookmarklet that I need to activate before pasting and magically it works!

jsFiddle of the solution

The bookmarklet

javascript:(function(){
  if (!window.jQuery) {
    console.error('No jquery found!');
    return;
  }
  if (window.hasPasteBookmarkletLoaded) {
     console.log('allready loaded');
     return;
  }
  $(document).ready(function(){
  	window.hasPasteBookmarkletLoaded = true;

    $('body').on('paste','.ag-structured-be-input input[name="communication-be-1"]', function(e) {
      const element1 = $('.ag-structured-be-input input[name="communication-be-1"]');
      const element2 = $('.ag-structured-be-input input[name="communication-be-2"]');
      const element3 = $('.ag-structured-be-input input[name="communication-be-3"]');
    
      const pasteData = e.originalEvent.clipboardData.getData('text').trim();

      console.log('Pasted "'+pasteData+'"');
      const regex = /^(\+\+\+)?(\d{3})\/?(\d{4})\/?(\d{5})(\+\+\+)?$/;    
      const nonIntRegex = /[^\d]/g;
      const stripped = pasteData.replace(nonIntRegex,'');

      if (regex.test(pasteData)) {
        console.log('Regex passed!');
        console.log('Stripped: ',stripped);
        console.log('Stripped: ',stripped.slice(0,3));
        console.log('Stripped: ',stripped.slice(3,7));
        console.log('Stripped: ',stripped.slice(7,12));

        element1.val(stripped.slice(0,3)).trigger('change');
        element2.val(stripped.slice(3,7)).trigger('change');
        element3.val(stripped.slice(7,12)).trigger('change');
      } else {
        console.log('No regex match');
      }
    });
  });
})();