Questions tagged [eregi]

PHP function for case insensitive regular expression matching

https://php.net/manual/en/function.eregi.php

Deprecated as of PHP 5.3.0 in favor of .
Removed as of PHP 7.0.0.

See also How can I convert ereg expressions to preg in PHP? on the required regex delimiters.

89 questions
0
votes
2 answers

PHP regular expression match gives error

Trying to check the string for pattern. $variable = '[text]'; if (eregi("/(\[(.*?)\])/", $variable)) {} This code gives error eregi() [function.eregi]: REG_BADRPT What is the solution for this?
James
  • 42,081
  • 53
  • 136
  • 161
0
votes
1 answer

LGRPHOTO PHP error preg_match(): Unknown modifier 'j' and No ending delimiter '.'

So I grabbed the very good but kinda old PHP script that's no longer supported from LGRphoto. Found out that FUNCTION eregi() IS DEPRECATED so replaced it with preg_match(). Seems to make the script work fine except for 2 errors. Thought it might be…
testing123
  • 761
  • 6
  • 13
  • 37
0
votes
1 answer

I need assistance with eregi - preg_match

I was getting the following error: Deprecated: Function eregi() is deprecated in /home/herbalhe/public_html/admin/includes/auth.inc.php So I searched and found that I should be using preg_match() instead of eregi(). So I made the changes and now…
0
votes
0 answers

PHP eregi() error

I have some code in PHP and HTML, I'm trying to create a photo gallery, my function reads all the png/jpg/gif files in a folder then displays them on a table in my browser, this is my code.
Omaruchan
  • 403
  • 1
  • 5
  • 12
0
votes
1 answer

Replace old eregi function PHP

I'm having problems to fix this old PHP eregi funxtion becouse it uses IN parameter.. It's script for captcha generation class_log.php from Matthieu MARY old code: $sMotif = "--$sIN ([a-zA-Z0-9]{3,4},)*([a-zA-Z0-9]{3,4}){1}"; if ((eregi("$sMotif…
John Mark
  • 37
  • 7
0
votes
1 answer

How can I grab all nodes from XML with PHP+mySQL?

I need to grab all nodes from XML. After I try use below PHP coding. It is work. But I can not grab and image from xml. Here is XML from others website (UTF-8 Thai Language) http://www.dailynews.co.th/rss/rss.xml Here is my PHP code…
0
votes
0 answers

Converting specific eregi function to preg_match

I have read all the questions and answers here and am having trouble converting the following depricated eregi function for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) { reset($this->languages); while (list($key, $value) =…
0
votes
1 answer

PHP's eregi to preg_match conversion

if ((eregi('opera mini', $_SERVER['HTTP_USER_AGENT'])) == 1) How can I convert this? if ((preg_match('opera mini', $_SERVER['HTTP_USER_AGENT'])) == 1) The above does not work.
Reeecz3
  • 21
  • 1
  • 9
0
votes
0 answers

php mail eregi and preg_match error

I have php mail form for users and after upgrade got this error: Deprecated: Function eregi() is deprecated Here is code line which is checking email for valid: if(trim($_POST['COTB_05']) == '') {$hasError = true;} else if…
JU1CY
  • 123
  • 1
  • 10
0
votes
3 answers

String to time - convert eregi_replace to preg_match

Now I'm using function eregi_replace() which is deprecated and I want to convert it to function preg_match(). Now I have this: foreach ($lesson as $key => $val) { $lesson_time[$key]->fromTime = eregi_replace('([0-9]{2})([0-9]{2})',…
Jaroslav Klimčík
  • 4,548
  • 12
  • 39
  • 58
0
votes
2 answers

eregi_replace depricated how to replace correctly?

I just discovered that the eregi is deprecated, and that preg replace works differently. How would you translate this? $text = eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]", "", $text);
Coolcrab
  • 2,655
  • 9
  • 39
  • 59
0
votes
1 answer

eregi_replace() is deprecated

I have just created a simple word filter for users bios when they are updated. This is the code: for($i=0;$i < sizeof($badwords);$i++){ srand((double)microtime()*1000000); $rand_key = (rand()%sizeof($replacements)); $str =…
Harry
  • 3
  • 1
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

How to validate US phone numbers, US state code and US zip code in PHP?

I want to validate US phone number, US state code and US zip code using PHP for it I wrote following functions but they are not working properly. /** check phone number validation**/ function phone_no($str) { return (bool)eregi( "^([-\(\)\+,…
PHPLover
  • 1
  • 51
  • 158
  • 311
0
votes
2 answers

Eregi function is deprecated

Here is my code (from submit.php) that is throwing an error: $email_from = $_POST['email']; // required $error_message = ""; $email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$"; if(!eregi($email_exp,$email_from)) { $error_message .= 'The Email…
Charles L
  • 63
  • 1
  • 1
  • 6