Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6385885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:57:19+00:00 2026-05-25T02:57:19+00:00

My code was if(eregi($pattern,$file)){ $out[‘file’][]=$file; }else But is doesn’t work in php 5.3, it

  • 0

My code was

if(eregi($pattern,$file)){
$out['file'][]=$file;
}else

But is doesn’t work in php 5.3, it shows the alert

Function eregi() is deprecated

so I changed to

if(preg_match($pattern,$file)){
$out['file'][]=$file;
}else

But now it shows

preg_match(): No ending delimiter '.' found

Did I enter any wrong syntax?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:57:20+00:00Added an answer on May 25, 2026 at 2:57 am

    The pattern needs to have some sort of delimiter character surrounding it.

    if(preg_match('/' . $pattern . '/',$file)){
    

    / is typical, but “any non-alphanumeric, non-backslash, non-whitespace character” could be used. Just make sure your delimiter character doesn’t appear in the $pattern itself.

    So if your pattern was http://(.*), which already has / characters in it, you might want to choose something else like ~:

    if(preg_match('~' . $pattern . '~',$file)){
    

    Alternatively, as @jensgram notes below, if you can’t guarantee your pattern won’t contain a certain delimiter character, you could escape those characters in the pattern with preg_quote(), like so:

    if(preg_match('~' . preg_quote($pattern, '~') . '~',$file)){
    

    Oh, also, since you’re using eregi() (case-insensitive), you’ll want to add the i modifier for case-insensitive to your pattern, outside the delimiter.

    if(preg_match('~' . $pattern . '~i',$file)){
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this php code. but it's giving error Deprecated: Function eregi() is deprecated
I have the same expression in Javascript but it won't work in PHP for
I use some code to turn urls into working links with php. But the
I am replacing PHP deprecated functions in my website. I have this code: (eregi(<[^>]*object.*\?[^>]*>,
I am recieving the error: Deprecated: Function eregi() is deprecated in C:\wamp\www\registration\class.register.php on line
I have the following PHP code that checks if an email is valid: if
Here is the code I'm using for the submitHandler: submitHandler: function() { $('.holder').fadeOut('slow'); $('#loading').fadeIn('slow');
a little question. I have this code, which is works perfect for files, but
I am using a lib which uses $pattern = LIMIT[^\w]{1,}([0-9]{1,})([\,]{0,})([0-9]{0,}); $replacement = ; eregi($pattern,
i have a code to get a list of pattern from a website: https://noembed.com/providers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.