need help in regular expression namely:
This is how the script works fine:
function callbackFunction( $matches) { echo $matches[1]."\n"; echo $matches[2]."\n"; echo $matches[3]."\n"; } $pattern = '!\\[hide=([0-9,]+),user=(.+?)\\](.+?)\\[\\/hide\\]!is'; $subject = '[hide=3,user=test1,test2]rgqgefrefe[/hide]'; print_r(preg_replace_callback($pattern, 'callbackFunction', $subject, -1)); Conclusion
3 test1,test2 rgqgefrefe if we remove the user in the subject, the code does not work
$subject = '[hide=3]rgqgefrefe[/hide]'; I need the Hybrid to work with both [hide=цифра,user=логин] , as well as separately as [hide=1] and [hide=login1,login2] and what the result would be like
1 user1,user2 rgqgefrefe
[user=login1,login2]closing tag should be[/user]? - Anton Shchyrov