<?php
$re = '/(?|{([^}]*)}|\[([^]]*)])/';
$str = "{A''BsCb}";
foreach ($m[1] as $match) {
}
PD9waHAKCiRyZSA9ICcvKD98eyhbXn1dKil9fFxbKFteXV0qKV0pLyc7IAokc3RyID0gIntBJydCc0NifSI7IAokcmVzID0gYXJyYXkoKTsKcHJlZ19tYXRjaF9hbGwoJHJlLCAkc3RyLCAkbSk7CmZvcmVhY2ggKCRtWzFdIGFzICRtYXRjaCkgewoJcHJlZ19tYXRjaF9hbGwoJ35bQS1HLV1bXkEtR10qficsICRtYXRjaCwgJHRtcCk7CgkkcmVzID0gYXJyYXlfbWVyZ2UoJHRtcCwgJHJlcyk7Cn0KcHJpbnRfcigkcmVzKTs=