Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Help with preg_match, I think...lol
Old 01-08-2006, 05:23 AM Help with preg_match, I think...lol
Junior Talker

Posts: 3
Location: High Point NC
Trades: 0
Hey everyone,

After almost reading everything on the web, including php.net - I can't find a script to help me allow spaces and/or regular characters in my text areas or text fields.

Can someone please help?

If I have: field1, field2, field3, etc.

I want to allow 0-9, a-z, A-Z, spaces, and /&+$*'"

I have been ripping my hair out with multiple tries with no avail.

Thanks,
xsfssg a.k.a. Chromedome

Last edited by xsfssg; 01-08-2006 at 05:25 AM..
xsfssg is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-08-2006, 09:14 AM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
You've left the realm of PHP and entered into Regular expressions. Try this:
PHP Code:
// modify to allow/disallow any charachter you want
$pattern "/([^ &\"'+$*a-zA-Z0-9])/";

if (
preg_match($pattern$text) ) {
   echo 
"invalid characters found";
} else {
   echo 
"all good";

You can use http://www.quanetic.com/regex.php to test your regex patterns
Anacrusis is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help with preg_match, I think...lol
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.42340 seconds with 12 queries