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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:14:31+00:00 2026-05-13T19:14:31+00:00

I have a regular expression for matching URIs. For example, preg_match(/^my\/uri\//i, my/uri/whatever); Which I

  • 0

I have a regular expression for matching URIs. For example,

preg_match("/^my\/uri\//i", "my/uri/whatever");

Which I use for routing, for exmample “http://www.mywebsite.com/my/uri/page.html” will match the above (with the protocol/host removed of course).

Is there any way to evaluate the regular expression into the most general URI that will match? For example,

“my/uri/”

  • 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-13T19:14:31+00:00Added an answer on May 13, 2026 at 7:14 pm

    I didn’t understand what you actually want.

    This code might be what you need:

    $general_uri = 'my/uri/';
    $regex = '/^' . preg_quote($general_uri) . '/i';
    

    If you want reverse of the above code:

    $regex = '/^my\/uri\//i';
    $general_uri = str_replace('\\', '', preg_replace('/^\/\^(.*)\/i?$/', '$1', $regex));
    

    However above code will not work on complicated regexes.

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

Sidebar

Related Questions

I have a regular expression which allows the value range '1111' - '999999', excluding
I have a regular expression which uses GroupCollection s in it's capture to capture
i have simple regular expression: ^123$ Matches are for example 123 1234 etc. How
I have a regular expression ^[a-zA-Z+#-.0-9]{1,5}$ which validates that the word contains alpha-numeric characters
I m just learning regular expression matching using javascript, and have a doubt regarding
I have the following regular expression: ^[x]{1}[a-z]{3,4}:[a-z0-9]{1,6} I want to use it to be
I have a really simple regular expression setup. preg_match('/[0-9]*/', $item, $id); $item's string value
I have a simple regular expression which looks something like ([a-z]*)( +[a-z]=[0-9])* and it
I'm trying to use the Daring Fireball Regular Expression for matching URLs in Java,
Hello I have a question about matching groups based on the following regular expression

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.