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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:12:58+00:00 2026-05-15T02:12:58+00:00

I have this regular expression: ([http://some.url.com/index.php?showtopic=\]*)([0-9]+(?:\.[0-9]*)?) its for extracting links to topics from forum

  • 0

I have this regular expression:

([http://some.url.com/index.php?showtopic=\"]*)([0-9]+(?:\.[0-9]*)?)

its for extracting links to topics from forum

Now when i use it in my script

$url = "([http://some.url.com/index.php?showtopic=\"]*)([0-9]+(?:\.[0-9]*)?)";

preg_match_all spits: “Unknown modifier ‘(‘”

This is also the call to preg_match

preg_match_all($url, $str, $matches,PREG_OFFSET_CAPTURE,3);

Can anyone help me with this obviously stupid problem

  • 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-15T02:12:59+00:00Added an answer on May 15, 2026 at 2:12 am

    PCRE requires delimiters that separate the actual regular expression from optional modifiers. With PHP you can use any non-alphanumeric, non-backslash, non-whitespace character and even delimiters that come in pairs (brackets).

    In your case the leading ( is used as delimiter and the first corresponding closing ) marks the end of the regular expression; the rest is treated as modifiers:

    ([http://some.url.com/index.php?showtopic=\"]*)([0-9]+(?:\.[0-9]*)?)
    ^                                             ^
    

    But the first character after the ending delimiter (() is not a valid modifier. That why the error message says Unknown modifier ‘(‘.

    In most cases / is used as delimiter like in Perl. But that would require to escape each occurrence of / in the regular expression. So it’s a good choice to choose a delimiter that’s not in the regular expression. In your case you could use # like BoltClock suggested.

    Oh, and by the way: A character class like [http://some.url.com/index.php?showtopic=\"] represents just one single character of the listed characters. So either h, t, p, :, /, etc. If you mean to express http://some.url.com/index.php?showtopic=" literally, use just http://some\.url\.com/index\.php\?showtopic=" (don’t forget to escape the meta characters).

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

Sidebar

Related Questions

all! I have a text like this Some text with uri http://test.com and other
I have this url string http://apistaging.yoolk.com/listings/F7B519E8-135C-43D0-A35F-764B582EDC48?domain_name=cambodiastaging.yoolk.com&display=basic I would like to get only the uuid
I have this Regular Expression that matches the following strings: <!-- 09-02-2009 ---> <!--
I have this light regular expression to validate the coordinates: ^([0-9.,-]+){18,20}$^ . If the
So basically I have this giant regular expression pattern, and somewhere in the middle
I have a regular expression to validate the dates and it works fine, this
I have a regular expression to validate a input value. At this point I
Is a regular expression the correct way of going about this? I have a
I have these variables: boost::regex re //regular expression to use std::string stringToChange //replace this
I have this XML content: $XML = <item xmlns='http://...'>Some value</item>; I want to extract

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.