Regular expression and special characters

This is a discussion on Regular expression and special characters within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi! I need to validate a text field in a form (you can enter only text and no spaces). But ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-19-2007
Zvonko Biškup
 
Posts: n/a
Default Regular expression and special characters

Hi!

I need to validate a text field in a form (you can enter only text and no
spaces).
But I have a iso-8859-2 character set and Croatian letters don't pass
validation.
Here is a piece of code:

$result = ereg ("^[A-Za-z0-9]+$", $input);

Any help appreciated.
Zvonko

Bok!




Reply With Quote
  #2 (permalink)  
Old 03-19-2007
Anze
 
Posts: n/a
Default Re: Regular expression and special characters


You can add croatian letter to the list of allowed chars:
$result = ereg ("^[A-Za-z0-9??????????]+$", $input);

Greetings from slovenia! ;)

An?e


Zvonko Biškup wrote:

> Hi!
>
> I need to validate a text field in a form (you can enter only text and no
> spaces).
> But I have a iso-8859-2 character set and Croatian letters don't pass
> validation.
> Here is a piece of code:
>
> $result = ereg ("^[A-Za-z0-9]+$", $input);
>
> Any help appreciated.
> Zvonko
>
> Bok!


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:45 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0