Looking for someone to make a regexp for me

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 91
Joined: Sat Aug 13, 2011 7:20 pm

Mon May 28, 2012 9:48 pm


I'm happy to pay someone that can write me a regexp that does the following.

' - single quotes
& - ampersands
- single space

any letters or digits in any language eg acompáñame

It has to fit into the filter_var I have below, which returns true if a match on an illegal character is found (the regexp I have in there isn't working how I want):

if(filter_var($myWords, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>"/^[' &\p{L}\p{Nd}]*$/"))) === false) return true;

I will need to test it to make sure it works for what I need, and will need you to rework the regexp if it doesn't.

Payment would be via Paypal.

Thanks guys

User avatar
New php-forum User
New php-forum User
Posts: 86
Joined: Mon Jun 04, 2012 10:05 pm
Location: Ankara, Turkey

Tue Jun 05, 2012 10:51 am

It might be easier to create a regex by filtering illegal characters. A regex like this should allow any character except for exclamation marks (!) and question marks (?):

Code: Select all

$regex = '/^[^!\\?]*$/';
The ^ symbol inside of the [] brackets negates the character set, so that it matches any character except the ones listed.

Post Reply