/    Sign up×
Community /Pin to ProfileBookmark

Warning: ereg(): REG_EPAREN in

i have this line of code
Warning: ereg(): REG_EPAREN in update.php on line 7

[code=php]
/* 7 */ if (ereg(“/d(1,3}.d{2}/”, $pay3))
{
echo “hello”;
}
[/code]

everything I see on the web says that it is a peren issue but the ereg function I thought took 2 strings.

string 1 = “/d(1,3}.d{2}/”
string 2 = $pay3

what am I doing wrong???

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@bokehOct 13.2005 — ereg() doesn't need delimiters

Also you have miss matched brackets:

This: d[B]([/B]1,3}.d{2}

should be: d[B]{[/B]1,3}.d{2}
Copy linkTweet thisAlerts:
@DARTHTAMPONauthorOct 13.2005 — now if i do an echo ereg("d{1,3}.d{2}", $pay3); it I thought would have printed true or false, but it does not.

why?
Copy linkTweet thisAlerts:
@bokehOct 13.2005 — You cannot echo a boolean. If you want to see a print out of TRUE/FALSE use:
[code=php]var_dump(ereg("d{1,3}.d{2}", $pay3));[/code]
Copy linkTweet thisAlerts:
@DARTHTAMPONauthorOct 13.2005 — ok so now I added
[code=php]
var_dump(ereg("d{1,3}.d{2}", $pay3));
[/code]


$pay3 = 0.36

and the dump prints out bool(false)

why is this when the regexp should
<i>
</i>d{1,3} = 0
. = .
d{2} = 36


This should come out true not false.
Copy linkTweet thisAlerts:
@bokehOct 13.2005 — d is part of PCRE so it can be used with preg_match() etc but not ereg().

Try this instead: [code=php]var_dump(ereg('[0-9]{1,3}.[0-9]{2}', '0.36'));[/code]

By the way ereg() returns bool(false) on failure and INT(1) on success.
Copy linkTweet thisAlerts:
@DARTHTAMPONauthorOct 14.2005 — thank you vary much bokeh for all your help. I really appreciate it.
×

Success!

Help @DARTHTAMPON spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...