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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:10:41+00:00 2026-06-08T03:10:41+00:00

Howto to compare this string : commodity/search/oil/branch/index with this : commodity/search/*/branch/index It should return

  • 0

Howto to compare this string :

commodity/search/oil/branch/index

with this :

commodity/search/*/branch/index

It should return true although “oil” is replace with other word.

  • 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-06-08T03:10:43+00:00Added an answer on June 8, 2026 at 3:10 am
    $match = preg_match("/commodity\/search\/(.*)\/branch\/index/", "commodity/search/someotherword/branch/index");
    

    $match will be true (or some value evaluating to true, like 1) if a match is found.

    Note: the above will match on any extra path, such as commodity/search/some/other/word/branch/index

    If you just want to match a single word, but not something resembling a path structure, then you might try something like this:

    $match = preg_match("/commodity\/search\/[A-Za-z0-9_-]+\/branch\/index/", "commodity/search/some-OTHER_word/branch/index");
    

    This will only match against upper and lower case a-z characters, numbers, hyphens and underscores. Adjust as needed.

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

Sidebar

Related Questions

This is the Javascript Function. Please Explain How to compare two string in Javascript.
Possible Duplicate: How to compare Dates in C# This code of mine: public static
I have Collection List<Car> . How to compare each item from this collection with
Curious as to how to compare a text box string to the password the
Please tell me how to compare 2 string variables I'm not talking about a
I am trying to compare a string from getline(file,line) with a std::string s=mmee :
i have a string field (and i can't change this because the date format)
How should I be adding additional search/filter criteria to a Dynamic Data Web Application?
I'm trying to compare objects of a common base class together. The comparison should
I want to compare a string with user input character by character. e.g. I

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.