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 6706181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:29:24+00:00 2026-05-26T07:29:24+00:00

I am making a system that takes all optional subjects from a education and

  • 0

I am making a system that takes all optional subjects from a education and puts it in a database. This works fine.
Now I want to make sure if you choose “Finance A” you can’t choose “Finance C”, I’m trying to do this with preg_replace as the subject is a array. But it keeps giving me an error:

Delimiter must not be alphanumeric or backslash

Now here is some of the code:

if
(
    preg_replace("/" + $name_without_level + " (A|B|C)/", "", $andre_fag) 
        == $andre_fag
    || preg_replace("/" + $name_without_level + " (A|B|C)/", "", $andre_fag2)
        == $andre_fag2
){

The variable $name_without_level gives the Subject name without A, B or C, the Level.

How to fix the error? I have tried everything I can think of.

  • 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-26T07:29:24+00:00Added an answer on May 26, 2026 at 7:29 am

    Imagine $name_without_level is just "Finance / Markets". Imagine what happens to your regular expression.

    Use preg_quoteDocs to ensure you’re looking for the right string literally and you don’t destroy your regular expression:

    $pattern = sprintf('/%s (A|B|C)/', preg_quote($name_without_level));
    if
    (
        preg_replace($pattern, "", $andre_fag) == $andre_fag
        || preg_replace($pattern, "", $andre_fag2) == $andre_fag2
    ){
    

    This does not mean that this is your only problem with the code. You need to do error checking to actually locate the error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently making some system that will gather statistical reports from different sites, for
I've been making a system that takes in data about drivers, potential passengers and
So I'm making this android application, that needs to read data from user-provided CSV
I'm making a system called NCIV in PHP. In that system you can change
I am making a list of view in my application that shows all installed
My application works fine in all versions of Android except It is failing because
Hi all I'm making a system which is essentially a scheduled task system. I
I'm making a rating system, and I have the following jQuery code on my
I'm making a PM-system on my site. And I want to know ultimate db
I have been making a threaded comment system as a way to learn php

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.