# Regular Expression Error : Uknown modifier error

**URL:** <https://forum.kirupa.com/t/regular-expression-error-uknown-modifier-error/219891>\
**Category:** programming\
**Created:** [March 20, 2007, 10:53pm UTC](https://forum.kirupa.com/t/regular-expression-error-uknown-modifier-error/219891 "2007-03-20T22:53:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beebs](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Beebs](https://forum.kirupa.com/u/Beebs)\
**Post date:** [March 20, 2007, 10:53pm UTC](https://forum.kirupa.com/t/regular-expression-error-uknown-modifier-error/219891/1 "2007-03-20T22:53:05Z")

</div>

Can someone help me with this error message :

```auto
Warning: preg_replace() [function.preg-replace]: Unknown modifier 'b' in C:\wamp\www\outputfunctions.php on line 37

```

Here’s the function :

```auto
function bbcode($data) {
  $sql = "SELECT * FROM bbcode";
  $result = mysql_query($sql);
  if (mysql_num_rows($result) > 0) {
    while($row = mysql_fetch_array($result)) {
      $bbcode['tpl'][] =
        "/" . html_entity_decode($row['template'],ENT_QUOTES). "/i";
      $bbcode['rep'][] =
        html_entity_decode($row['replacement'],ENT_QUOTES);
    }
    $data1 = preg_replace($bbcode['tpl'],$bbcode['rep'],$data);
    $count = 1;
    while (($data1 != $data) and ($count < 4)) {
      $count++;
      $data = $data1;
      $data1 = preg_replace($bbcode['tpl'],$bbcode['rep'],$data);
    }
  }

  return $data;
}

```

Here’s the table :

```auto

CREATE TABLE IF NOT EXISTS bbcode (
  id int(11) NOT NULL auto_increment,
  template varchar(255) NOT NULL default '',
  replacement varchar(255) NOT NULL default '',
  PRIMARY KEY (id)
)ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

-- 
-- Dumping data for table `bbcode`
-- 

INSERT INTO `bbcode` VALUES (1,'\[b\]([^[]+?)\[/b\]','<b>$1</b>');

```

Other Info : PHP 5 MySql : 5.0.22

Thanks a lot
