Modx strips mysql [[:char_class:]] from the sql string in snippet

I’m trying to concat some strings for sql query in a snippet but it strips all [[:char_class:]] from it.

$regexp_arr = array('(word1)', '(word2)');
$value = 'word3';
$regexp_str = implode('[[:space:]]', $regexp_arr);
$v1 = '[[:<:]](' . $value . ')';

echo $regexp_str;
// gives
'(word1)(word2)';
// instead of 
'(word1)[[:space:]](word2)'

echo $v1;
// gives
'(word3)' 
//instead of 
'[[:<:]](word3)'

Has it something to do how modx parses tags and placeholders? Thought that strings in snippets doesn’t get pre-parsed the way chunks do…
Is there something I can do about it ? Thanks in advance for any clarifications!
(modx 2.3.3, php 5.6.36)

1 Like

they don’t get parsed within the snippet, but when you echo or return them, MODX will try to parse them after the snippet has echoed the string.

Do you need to output your sql string or do you echo the string only for debugging?
For debugging you could log the string with $modx->log
https://docs.modx.org/current/en/extending-modx/xpdo/class-reference/xpdo/xpdo.log

Thank you Bruno, that’s true. Logging the string shows correct result.