Codeigniter自动插入空格

I have a problem with codeigniter in a query on postgresql, it automatically adding a spacebar on the query for no reason

This is the query:

if ($_respuesta) {
$this->db->where("regexp_replace(consulta_respuestas.respuesta,'<[^>]*>', '', 'g') LIKE '%".$_respuesta."%'");
}

the problem is when i check the output it adds a space in here:

' < [^>]*>'

Between the apostrophe and the less than symbol, that provokes the query doesn´t work as supposed.

Is there a way to fix this?

Thanks in advance

Try this.

$reg_val = "<[^>]*>";

if ($_respuesta) {
  $this->db->where("regexp_replace(consulta_respuestas.respuesta, $reg_val, '', 'g') LIKE '%".$_respuesta."%'");
}