I have string:
=?windows-1256?B?IObH4cPM5dLJIA==?= =?windows-1256?B?x+HYyO3JIC4uLg==?= =?windows-1256?B?LiDH4djj5s3Hyg==?= =?windows-1256?B?Rlc6IOTP5skgKA==?=
I need to extract all matches between ?B?
and ==?=
.
As a result I need:
IObH4cPM5dLJIA
x+HYyO3JIC4uLg
LiDH4djj5s3Hyg
Rlc6IOTP5skgKA
P.S. This string is taken from textarea and after function executed, script should replace current textarea value with result. I've tried everything,
var result = str.substring(str.indexOf('?B?')+3,str.indexOf('==?='));
Works almost the way I need, but it only finds first match. And this doesn't work:
function Doit(){
var str = $('#test').text();
var pattern = /(?B?)([\s\S]*?)(==?=)/g;
var result = str.match(pattern);
for (var i = 0; i < result.length; i++) {
$('#test').html(result);
};
}