Old regular expression function in PHP that is now DEPRECATED in favour of preg_match()
Questions tagged [ereg]
59 questions
0
votes
3 answers
How to convert this deprecated ereg() using pointer to preg_match()
Using php 5.3 - ereg() deprecated...
I'm trying to convert this function (to preg_match), but I don't understand the "pointer"...
function gethostbyaddr_new($ip)
{
$output = `host -W 1 $ip`;
if (ereg('.*pointer ([A-Za-z0-9.-]+)\..*',…

Naomi
- 97
- 5
0
votes
1 answer
Validating date in PHP
Possible Duplicate:
how to validate date with PHP
Hi there,
I have a script which checks the date passed to it in this format YYYY-MM-DD and validates it, however it seems to be invalidating users who are under 20 whereas I'd prefer it to be…

ae2011
- 69
- 1
- 1
- 5
0
votes
1 answer
Need help in rephraseing two lines of code because.eregi_replace is depricated
So I purchased a script package which is using eregi_replace and I do not know how to re-write the code to play with preg_replace()
The error is: Deprecated: Function eregi_replace() is deprecated in…

DDavis
- 3
- 1
0
votes
5 answers
how to solve the ereg function deprecated error
I am working with SEO PHP scripts and I am just following Google SEO scripts. When I used the search terms I got an error like the following:
Deprecated: Function eregi() is deprecated in E:\wamp\www\subgoogle\nusoap.php on line 3876
Deprecated:…

lavan
- 67
- 1
- 3
- 8
0
votes
0 answers
Can't make switch from ereg to preg_match work
I have read everything I could find on switching from ereg (deprecated) to preg_match. My attempts to solve it by adding delimiters and escape expressions (which may not be necessary) have been in vain. I started with:
$file =…

Earnest Overly
- 15
- 1
- 4
0
votes
1 answer
Migrating a site: ereg to pregmatch?
I'm in the process of migrating a horrible drupal site to a new server - a server with a newer version of PHP. Checking the site I get the following error:
Deprecated: Function ereg() is deprecated in…

Dan Lee
- 684
- 4
- 15
- 35
0
votes
1 answer
PHP upgrade from 4 to 5 requires changing ereg_replace() and ereg() with delimiters
When running former PHP 4 pages in PHP5 I get Deprectiated errors:
I know there are some back slashes that go in there. (or is it forward slashes?) but the " +" item to replace throws me off.
Function ereg_replace() is deprecated:
$perms =…

JustJohn
- 1,362
- 2
- 22
- 44
0
votes
0 answers
How to use ereg_replace to convert image link to display image
How can i use ereg to replace URL of images with tag.
My images URL have two starts embraced like this **http://myimageslink/photo.jpg**
i want to convert to
I use ** embrace because when don't have…


Marcus
- 295
- 4
- 16
0
votes
1 answer
Check text area for URLs with preg_match
i found this code for checking a text area:
if (strpos($textp, "http://") !== false ||
ereg("(www.[a-zA-Z0-9_-]+)\.([a-zA-Z0-9.]+)",$textp)){
$textp = '';
} else {
because ereg is depreacted I would like to replacy by preg_match instead.…

user3361974
- 23
- 2
0
votes
1 answer
warning if(ereg error first then other error
Here is my original code listed below.
if(ereg($pattern,strtolower($this->get_domain())) && !ereg("^-|-$",strtolower($this->get_domain())) && !preg_match("/--/",strtolower($this->get_domain()))){
This is the error
Deprecated: Function ereg() is…

user3263765
- 3
- 2
0
votes
1 answer
block special characters with ereg
elseif (!ereg("^.+@.+\\..+$", $email)) {
$msg="• Invalid email: that is not a valid e-mail address."; $email="";
}
thats the part of the code im trying to edit it so they cant use ' and = in there email

John Kalman
- 1
- 1
0
votes
1 answer
Deprecated: Function ereg() & ereg_replace()
i'm actually using a script i've used for years before and when i put it in my website, i got the error "Deprecated: Function ereg() & ereg_replace()". I'm actually unable to understand how to modify the ereg() things in preg() things. If someone is…

user2720263
- 11
- 1
0
votes
1 answer
ereg to preg_match conversion - getting barometer
I need some help converting an old ereg expression to preg_match. I'm wanting to pull the barometer (altimeter) out of a airport METAR.
ereg('^(A|Q)([0-9]{4})',$part,$pieces)
The above is the expression I need to convert to preg_match. I tried this…

Dutchcoffee
- 269
- 1
- 5
- 12
0
votes
1 answer
Convert to preg from ereg
I don't know how to convert from ereg to preg; could someone help me with this line?
if (ereg("[/[/]",$keyword)) { ... }
0
votes
4 answers
Need to switch from ereg() to preg_match()
I need to know what this line of code does, tried to figure it out because i have to build it with preg_match() but I didn't understand it completely:
ereg("([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})", $date)
I know it checks a date, but i don't know in…

emjay
- 1,491
- 5
- 17
- 35