Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-21-2002, 08:21 AM   PM User | #1
Extrovertive
New to the CF scene

 
Join Date: Jul 2002
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Extrovertive is an unknown quantity at this point
help with simple regular expression code

PHP Code:
<?php
$name 
'@^#@#';
    if(
ereg("([[:punct:]]+)[[^:alnum:]]"$name)) echo "yes";
?>
ok, im a little stumped on regular expression. what im trying to do above is make sure th $name string contains all punctuation marks and not a single letter or numerial. however, it doesn't. why?
Extrovertive is offline   Reply With Quote
Old 07-22-2002, 06:03 AM   PM User | #2
mordred
Senior Coder


 
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
mordred is an unknown quantity at this point
That seems to be a smilie-code-polluted RegExp indeed... ;)

I would simply test if a character appears that is not in the "punct" class.

PHP Code:
$name '@^#@#';
if(!
ereg("[^[:punct:]]"$name)) {
    echo 
"yes";

Though I still wonder for which application this would be needed.
mordred is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:36 AM.


Advertisement
Log in to turn off these ads.