Jump to content

regular expression


Rahul Dev

Recommended Posts

Hello guys i have a problem while inserting a string to db. The string is cut out and only part of it is inserted and the string is not trimmed

 

my code:

<?php
require ('dbconnect.php');
$text = "Maltraitance : Shirin Aumeeruddy-Cziffra réclame la fermeture de la crèche «Le Nid» de Sodnac ";
$newString = preg_replace('/^[a-zàâçéèêëîïôûùüÿ]*$/i', ' ', $text);
$newString2 = trim($newString);
echo $newString2;
$sql = "INSERT INTO test VALUES('".$newString2."')";
$result = mysql_query($sql);

?>


 

The part that is inserted is:

Maltraitance Shirin Aumeeruddy Cziffra r

 

As you can see there's an additional space and the string is not complete

Any1 can help??

Link to comment
https://forums.phpfreaks.com/topic/228770-regular-expression/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.