You do not need a regular expression for such a simple task, str_string () will do this.
$str = str_replace(array("[","]"), array("|", ""), $str);
OUTPUT
Some text | id
Using a regex to do something like this is like asking Einstein to solve 2 + 2.
source share