The strings are separated into arrays

< H2 > problem description < / H2 > The

string is separated into an array. Due to too many spaces, there is no particularly good idea

< H2 > current implementation method < / H2 >
I think the current implementation method is really a bit troublesome
["sourceIp == 86.248.198.93", "&& sourceIp != 86.248.198.93", "|| sourceIp == 86.248.198.93", "|| sourceIp != 86.248.198.93", "&& sourceIp == 86.248.198.93:737", "&& sourceIp != 86.248.198.93:737", "|| sourceIp == 86.248.198.93:737", "|| sourceIp != 86.248.198.93:737"]
Apr.07,2022

var str = 'sourceIp == 86.248.198.93 && sourceIp != 86.248.198.93 || sourceIp == 86.248.198.93 || sourceIp != 86.248.198.93 && sourceIp == 86.248.198.93:737 && sourceIp != 86.248.198.93:737 || sourceIp == 86.248.198.93:737 || sourceIp != 86.248.198.93:737';
    const s=str.split(/\s*(?=\|{2}|\&{2})/);
    console.log(s);

want to do this?

const str = 'sourceIp == 86.248.198.93 && sourceIp != 86.248.198.93 || sourceIp == 86.248.198.93 || sourceIp != 86.248.198.93 && sourceIp == 86.248.198.93:737 && sourceIp != 86.248.198.93:737 || sourceIp == 86.248.198.93:737 || sourceIp != 86.248.198.93:737'

const arr = str.split(/\s+(?:&&|\|\|)\s+/)

console.log(arr)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e188-41429.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e188-41429.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?