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
Why do I get REG_BADBR
Old 10-04-2007, 09:50 PM Why do I get REG_BADBR
scrobins's Avatar
Skilled Talker

Posts: 50
Name: Stuart Robinson
Location: Busselton
Trades: 0
I am trying to match this pattern using this code;

PHP Code:
if(!ereg("^[A-Za-z -]{1-50}$",$_POST['$field'])) { 
but keep coming up with the error ;

Warning: ereg() [function.ereg]: REG_BADBR in

What am I doing wrong?

BTW - I'm using PHP 5.2.3
scrobins is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-04-2007, 10:31 PM Re: Why do I get REG_BADBR
Ultra Talker

Posts: 483
Trades: 0
What if you tried:
if(!ereg("^[A-Za-z \-]{1-50}$",$_POST['$field'])) {

ie. escape the lone dash in that first group?
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 10-05-2007, 12:15 AM Re: Why do I get REG_BADBR
scrobins's Avatar
Skilled Talker

Posts: 50
Name: Stuart Robinson
Location: Busselton
Trades: 0
Nup. No joy with this either.

Could there be some problem with PHP dealing with the closing $ delimiter?

If so, is there another possible work around to deal with this issue?
scrobins is offline
Reply With Quote
View Public Profile
 
Old 10-05-2007, 07:32 AM Re: Why do I get REG_BADBR
Ultra Talker

Posts: 483
Trades: 0
That definitely could be a problem

Instead of using double quotes use single quotes. That will stop the PHP interpreter trying to parse variables in the string.
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 10-05-2007, 09:08 AM Re: Why do I get REG_BADBR
scrobins's Avatar
Skilled Talker

Posts: 50
Name: Stuart Robinson
Location: Busselton
Trades: 0
Yer, tried it already but no joy there either. I've removed the !ereg() and just used it as ereg() and it seems to work but not as succinctly.

Cheers for your help TwistMyArm.
scrobins is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Why do I get REG_BADBR
 

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.25999 seconds with 12 queries