Question: How can I remove multiple "[" in HTML Tag ID attribute with Regex?

For example

```
<div id="test[12][45][67]">test inline [for example]</div>

```

Change to 

```
<div id="test12]45]67]">test inline [for example]</div>

```

Answer: 
What you could (most likely should) do is to use a PHP HTML parser, such as [PHP Simple DOM Parser](http://simplehtmldom.sourceforge.net/) to go over the HTML, extract the ID value and then replace it using something like so:

```
<?php
$string = <yourID>
$pattern = '/\[/g';
$replacement = '';
echo preg_replace($pattern, $replacement, $string);
?>

```

This would allow you to *safely* modify only your `id` section in a relatively simple manner.
using javascript:

```
function rem_open_square_brackets(_id) {
    if(_id) {
        return _id.replace(/[\[]*/g, '');
    }
    return _id;
}
var _id = rem_open_square_brackets('test[12][45][67]');
document.write(_id);

```

you could find all your ids and past them to the function and replace them with the return value.