v2
- by hkotsubo 8/19/202100
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const strs = [ 'foo <foo@prov.com>', 'bar <bar@prov.com>', 'baz <baz@prov.com> fdafad fad', 'invalid' ];
let r1 = /<(.*)>/;
let r2 = /<([^>]+)>/;

function comForNormal(s) {
    var inicio = null, fim = null;
    for (var i = 0; i < s.length; i++) {
        var c = s[i];
        if (c === '<') {
            inicio = i;
        } else if (c === '>') {
            fim = i;
            break;
        }
    }
    if (inicio !== null && fim !== null)
        return s.substring(inicio + 1, fim);
    return undefined;
}
function comIndexOf(s) {
    var inicio = s.indexOf('<');
    if (inicio === -1)
        return undefined;
    var fim = s.indexOf('>', inicio);
    if (fim === -1)
        return undefined;
    return s.substring(inicio + 1, fim);
}

delete caserun single casemove downdrag and drop case


ready



emails = strs.map(str => str.match(r1)?.[1]);
delete caserun single casemove upmove downdrag and drop case


ready



emails = strs.map(str => str.match(r2)?.[1]);
delete caserun single casemove upmove downdrag and drop case


ready



emails = strs.map(comForNormal);
delete caserun single casemove updrag and drop case


ready



emails = strs.map(comIndexOf);
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN