Page 1 of 1
regular expression
Posted: Wed Feb 23, 2011 11:30 pm
by Rahul Dev
.
Re: regular expression
Posted: Thu Feb 24, 2011 11:02 am
by anantha
the echo statement shows all the character.so the problem should be in DB. what is the character limit for the field in DB?
Re: regular expression
Posted: Thu Feb 24, 2011 11:11 am
by AbraCadaver
Not sure what you want, but you are replacing all of those characters plus all characters a-z and A-Z, why? Try:
Code: Select all
$newString = preg_replace('/[àâçéèêëîïôûùüÿ]/i', ' ', $text);
I don't know how the
i modifier works with those though.
Re: regular expression
Posted: Fri Feb 25, 2011 1:08 am
by Rahul Dev
.
Re: regular expression
Posted: Fri Feb 25, 2011 1:09 am
by Rahul Dev
.
Re: regular expression
Posted: Fri Feb 25, 2011 1:10 am
by Rahul Dev
anantha wrote:the echo statement shows all the character.so the problem should be in DB. what is the character limit for the field in DB?
my field limit is 10000 it still stores only part of the string
Re: regular expression
Posted: Fri Feb 25, 2011 1:15 am
by s.dot
Try using the u modifier
(just a guess)
Re: regular expression
Posted: Fri Feb 25, 2011 1:17 am
by s.dot
Actually, when you echo $newString2 it comes out fine.
So the problem is inserting into your database.
What is the database collation of your database and table?
Re: regular expression
Posted: Fri Feb 25, 2011 1:29 am
by Rahul Dev
.
Re: regular expression
Posted: Fri Feb 25, 2011 3:02 am
by waitely
The code to check the email using Perl compatible regular expression looks like this:
1. $pattern = "/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/";
2.$email = "
jim@demo.com";
3.if (preg_match($pattern,$email)) echo "Match";
4.else echo "Not match";
And very similar in case of POSIX extended regular expressions:
1.$pattern = "^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$";
2.$email = "
jim@demo.com";
3.if (eregi($pattern,$email)) echo "Match";
5. else echo "Not match";
web designers