Old regular expression function in PHP that is now DEPRECATED in favour of preg_match()
Questions tagged [ereg]
59 questions
0
votes
2 answers
preg_match(): Unknown modifier '@'
I used to use my function with ereg (check that there's one @ symbol),
ereg("^[^@]{1,64}@[^@]{1,255}$", $email)
but now it is deprecated. Why I am getting an error preg_match(): Unknown modifier '@' when I fixed it to…

Andrew
- 7,619
- 13
- 63
- 117
0
votes
1 answer
Convert eregi to preg_match and ereg_replace to preg_replace
Im using http://www.internoetics.com/2010/01/12/simple-whois-php-script/ PHP whois script and i need to config it for newest PHP version, i need convert ereg and eregi to preg_match and preg_replace
if ( (!eregi('^[a-zA-Z0-9-]+\.([a-zA-Z]{2,4})$',…

Null
- 518
- 7
- 13
0
votes
1 answer
converting/updating the deprecated function ereg()
Possible Duplicate:
How can I convert ereg expressions to preg in PHP?
The site I am working on has been migrated to a server using php 5.3.16 from 5.2.17
We have a problem with the function ereg being deprecated.
How can I resolve the issue with…

Lawrence DeSouza
- 984
- 5
- 16
- 34
0
votes
3 answers
error when changing ereg_replace to preg_replace
I am working on old sites and updating the deprecated php functions. I have the following code, which creates an error when I change the ereg to preg.
private function stripScriptTags($string) {
$pattern = array("'\/\*.*\*\/'si",…

Jamie
- 1,579
- 8
- 34
- 74
-1
votes
2 answers
Link or image preg/ereg replace?
Heres my issue. I'm building a website where you can share links/pictures. Now heres what I want to do. If the link is a link to a site, then display a link such as:
http://example.com
But heres my…

Jake
- 1,469
- 4
- 19
- 40
-1
votes
1 answer
ereg is deprecated conversion
Possible Duplicate:
Converting ereg expressions to preg
I need to convert the ereg usage here to something more current (since ereg is deprecated).
Here's the function my code currently relies on:
function ValidEmail($address)
{
if( ereg(…

doremi
- 14,921
- 30
- 93
- 148
-1
votes
1 answer
Ereg on OOP select option
I'm trying to create an ereg on a select option in object orientated programming for validation.
Though it is always returning true even though the selected option isn't part of the ereg!
In my class I have the following:
function…

breaker
- 41
- 1
- 6
-1
votes
1 answer
php (preg) Wont Work, Function ereg_replace() is deprecated
I have been upgrading some scripts to use recent coding but this one is getting to me. I have done some switching over to use the preg but this bit of code seems to be fighting back,
Heres the portion of code I need to replace, its part of code…

RobertDavid
- 1
- 2
-1
votes
1 answer
What's the ereg() equivalent
What's the PHP ereg() equivalent in Visual Basic .NET?
I'm trying to translate this tripcode encoder from PHP to VB.NET
function tripcode($name)
{
if(ereg("(#|!)(.*)", $name, $matches))
{
$cap = $matches[2];
$cap =…

Jeff Reed
- 231
- 1
- 6
- 23
-1
votes
1 answer
getting error: Warning: preg_match() [function.preg-match]: Unknown modifier ',' in
Here is the syntax I am trying to use to replace PHP5.3 problematic "if (ereg".
origianl code:
if (ereg('([0-9.-]{1,}),([0-9.-]{1,})', $location, $regs))
new code:
if (preg_match('/[0-9.-]{1,}/,/[0-9.-]{1,}/', $location, $regs))
this new code is…

Jim
- 1
- 3
-2
votes
2 answers
In PHP, I used the ereg() function to determine whether a specified string can possibly generated by an input regular expression
In PHP, I used the ereg() function to determine whether a specified string can possibly generated by an input regular expression. I want to display all the strings that could be possibly generated by the regular expression given. How could I do…

John
- 55
- 1
- 4
-3
votes
2 answers
ereg() to preg_match(), could you convert it for me?
I am just becoming crazy and it seems not difficult...
Could please someone convert the following expression to the new function preg_match?
ereg( "([0-9]{1,2})([0-9]{1,2})([0-9]{2,4})", $dFecIni, $aFecIni);
Thank you very much in…

Zoudan
- 11
- 3
-3
votes
2 answers
PHP: What is wrong with this preg_match that is converted from ereg
I've seen similar questions on here, but I don't think any of them helped with this.
I've inherited a site from someone who used an older version of PHP and specifically the ereg function. Their original reg ex was:
$regex = "[ ]+[0-9]+) (…

Nick
- 1,262
- 1
- 17
- 32
-4
votes
1 answer
What does this PHP regular expression mean?
I'm learning PHP regular expressions, and I came across something I'm having trouble making sense of.
The book gives this example in validating an e-mail address.
if (ereg("^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$", $email))
I'm not clear on a couple…

Hermes
- 1