$str = <<<'DOC'
var1='Value 1' and var2='Value 2'
var1='Value 1 a' and var2='2 b'
var1=' 1a ' and var2='2b'
var1='Value 1 2 3 abc 4'
DOC;
echo preg_replace_callback("/'[^']+'/", function($value) {
return str_replace(' ', '', $value[0]);
}, $str);
// var1='Value1' and var2='Value2'
// var1='Value1a' and var2='2b'
// var1='1a' and var2='2b'
// var1='Value123abc4'
/^([a-z])|\.\s*([a-z])/gm
$string = '40|https://site1.com/files/02bea218b601ef2cbc74e08dc8d78_1000_1000.png;77|https://site1.com/files/29037cbdc27707fe2d6b2cf4d3924_1000_1000.png;78|https://site1.com/files/923b6f214f8bffcf20fbbebe5365b_1000_1000.png;85|https://site1.com/files/f8b6dbe261e89877e23e6a6f00003_1000_1000.png';
$result = substr(preg_replace('/\|.*?(?:;|$)/', ',', $string), 0, -1);
echo $result; // 40,77,78,85
$str= '703@ext-local : PJSIP/703&SIP/99703& State:Idle Presence:available Watchers 16 1 hint matching extension 703';
preg_match('#(?<=State:)\S+#', $str, $state);
echo $state[0];
\S{1,20}
/^\S{1,20}$/m
let str = '10 Great and Easy English Books!!! You Must Read. A regular expre ! = ssion, !! ?? - () is a sequ ence of characters&&? that define a sea_rch pattern.';
let find = ['0greatandeasyengl', 'expressionisasequence', 'ersthatdefineasearchpattern'];
find.forEach(function(pattern)
{
let pat = '';
for (let i = 0; i < pattern.length; i++) {
pat += pattern[i] + '[^a-z\\d]*';
}
let reg = new RegExp(pat, 'i');
console.log(str.match(reg));
})