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
1
vote
3 answers

Remove the first 1 and space before a phone number?

I did searches and figured this would be an easy find. Though I haven't found anything related to exactly what I need and similar questions are from people from overseas that have different phone formats with plus signs. A lot of my phone number…
1
vote
1 answer

PHP Form Validation - Deprecated Function eregi()

I've just raised a separate question on a problem with an enquiry form that had a deprecated eregi PHP function. Unfortunately, there's another file I missed that validates the form which is riddled with them :( Here's the code below: /* ERRORS…
Brian
  • 67
  • 3
1
vote
3 answers

Contact form no longer working - Function eregi() is deprecated

I have an enquiry form on an old HTML website, this was working fine with an old version of PHP. The problem now is the Function eregi() which forms part of the code is deprecated in all new versions of PHP. I won't pretend I understand how this…
Brian
  • 67
  • 3
1
vote
1 answer

Deprecated eregi Call, preg_match Fix Needed

I have an open source program I am trying to integrate in a website. I would like to update a code in it that is causing problems with my development LAMP setup. if ($dbselect) { if (!eregi('utf',strtolower($script_encoding)) &&…
1
vote
2 answers

Is this regex right (eregi to preg_match conversion)

I am replacing PHP deprecated functions in my website. I have this code: (eregi("<[^>]*object.*\"?[^>]*>", $secvalue)) It is written on the php.net site that it eregi should be replaced with preg_match with i modifier. Is this coded…
hd.
  • 17,596
  • 46
  • 115
  • 165
1
vote
2 answers

Eregi Validation Issue

I've been reading and reading on regular expressions, but I can't figure out what's wrong with my code: if(eregi("^[A-Za-z0-9_\-]$", $username)){return true;} It never returns true. I'm trying to validate usernames and only allow lowercase a-z,…
Jack
  • 203
  • 1
  • 4
  • 9
1
vote
3 answers

PHP: make a string clickable

For a Mandarin learning-tool I would like to create links for each chinese "character" within a word. For example I have the chinese word "自行车" (bicycle). Then I would like to make each of the three characters "clickable". $word = '自行车'; And the…
D. Studer
  • 1,711
  • 1
  • 16
  • 35
1
vote
0 answers

"eregi" worked in php5.6, but "preg_match" replacement not working in php 7.2

""Eregi" works in php5.6 for this Photo Gallery Module: http://taraskrysa.com/pages/media/photo_gallery.php BUT, preg_match in php7.2 does not work for the same Gallery Module. I currently changed eregi to preg_match on the page link below, but no…
1
vote
1 answer

What to replace eregi() with?

What is eregi() replaced with in this instance? // get value of text inbetween tags function getContentByTag($tag1, $tag2, $string) { if (eregi("$tag1(.*)$tag2", $string, $out)) { $outdata = $out[1]; } return $outdata; } This…
Auzzzy
  • 59
  • 8
1
vote
1 answer

Eregi and preg_match replacement, big error on capcha and email validator

I know there are a lot of questions related to this subject, but after some days of research I didn't find something that could help this particular case, so here it is: I have replaced the deprecated eregi with preg_match in 2 files of my website,…
Klauss Gekker
  • 143
  • 2
  • 8
1
vote
2 answers

PHP eregi() is deprecated detect browser

I have a function to detect browser with version: # Agent - Webbrowsers function agent_browser($http_user_agent) { // Browsers $browsers = array ( 'Android Standaard' => '(Linux)(.*)(Android)(.*)(Mobile…
1
vote
2 answers

Warning: preg_match() [function.preg-match]: Unknown modifier '_'

Following is the regex I am trying to use $eregicheck = "^([-!#\$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#\$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,4}\$"; I changed the following lines return eregi($eregicheck, $emailtocheck); to return…
Venkateshwaran Selvaraj
  • 1,745
  • 8
  • 30
  • 60
1
vote
1 answer

Fixing eregi_replace functions

My website blew up recently because the eregi_replace got phased out. Now I need to convert them into a preg_replace or something else. This worked with most of my functions but I'm having trouble with the ones that simulate bbtags. Could someone…
Coolcrab
  • 2,655
  • 9
  • 39
  • 59
1
vote
1 answer

eregi_replace replacement

I'm pretty naff with regexpressions :( and I have inherited a bunch of code from a previous developer who has put lots of eregi_replace which are now deprecated on PHP 5.3 The functions in the code are: eregi_replace("[\]","",$text); I know I have…
Daniel Procter
  • 188
  • 1
  • 2
  • 16
0
votes
2 answers

How can `eregi()` function can be replaced in below code with `preg_match()` function?

How can eregi() function can be replaced here with preg_match() function in below given code? function getOS($userAgent) { // Create list of operating systems with operating system name as array key $oses = array ( 'iPhone' =>…
OM The Eternity
  • 15,694
  • 44
  • 120
  • 182