php regex preg_match validation

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
bradleybebad
Forum Newbie
Posts: 1
Joined: Thu Aug 19, 2010 2:54 pm

php regex preg_match validation

Post by bradleybebad »

Does this sort of regex within php preg_match look like a working validation?

if (preg_match("/^[a-zÇÑQÀÁÈÉÍÌÏÓÒÚÙÜ]|[\t]+$/i]",$_POST["i1"])) {
$_SESSION['i1'] = $_POST["i1"];
}
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: php regex preg_match validation

Post by Mordred »

A working validation for what? It does check (quite clumsily) if a string contains only a certain set of characters. Whether this is what you want, only you can tell :)
Post Reply