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

  • Home
  • SEARCH
  • 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 7552033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:39:23+00:00 2026-05-30T10:39:23+00:00

The x modifier code in this tutorial Php regex tutorial gives me the following

  • 0

The x modifier code in this tutorial Php regex tutorial gives me the following error:

Warning: preg_match() [function.preg-match]: Unknown modifier ' ' in C:\xampp\htdocs\validation\test.php on line 16
Pattern not found 

What’s wrong with it?

<?php
// create a string
$string = 'sex'."\n".'at'."\n".'noon'."\n".'taxes'."\n";

// create our regex using comments and store the regex
// in a variable to be used with preg_match
$regex ="
/     # opening double quote
^     # caret means beginning of the string
noon  # the pattern to match
/imx
";

// look for a match
if(preg_match($regex, $string))
        {
        echo 'Pattern Found';
        }
else
        {
        echo 'Pattern not found';
        }
?> 
  • 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-30T10:39:24+00:00Added an answer on May 30, 2026 at 10:39 am

    You have an extra newline in the modifiers because the terminating quote is on a new line after imx, that is why you are seeing unknown modifier ' '

    Try changing it to this:

    $regex ="
    /     # opening double quote
    ^     # caret means beginning of the string
    noon  # the pattern to match
    /imx";  // move "; to same line as /imx
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am newbie trying to learn some code. I am following the tutorial on
I've used the following code to do an XSLT in php: # LOAD XML
I've been experimenting with ASP.NET MVC and following this tutorial to create the basic
I want to encrypt the SQLite database in my QT application. This tutorial: http://www.qtcentre.org/wiki/index.php?title=Building_QSQLITE_driver_with_AES-256_encryption_support
Following this tutorial http://netbeans.org/kb/docs/javaee/maven-osgiservice-cdi.html I have managed to create a simple OSGI bundle and
I ran across this chunk of code (modified) in our application, and am confused
While cleaning some code today written by someone else, I changed the access modifier
The list sort() method is a modifier function that returns None . So if
I'm javascript newbie...please bear with me. Modified some jQuery animation code from w3c tutorial.
I'm going through the w3cschools XSLT tutorial, and I am at this page: xsl-if

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.