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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:29:40+00:00 2026-06-09T08:29:40+00:00

First, I know my question would be possibly duplicate of this one , but

  • 0

First, I know my question would be possibly duplicate of this one, but I need solution which must be correct in 100%. And I am not so good in regexes to achieve this 🙂

I have maaaaaaaaany requests with few params passed like ...&params=key1=value1|key2=value2|.... There may be few params and I don’t know the order. What I need is to catch request that contains exact key1=myValue1 and key2=myValue2, but they can be like:

  • key1=myValue1|key2=myValue2
  • key2=myValue2|key1=myValue1
  • key1=myValue1|key3=myValue3|key2=myValue2

or even more complicated. What is known:

  • params is only part of the request, so it can be ?something=other&params=key1=value1|key2=value2 or ?params=key1=value1|key2=value2&something=other
  • inside params parameter there are not white chars, only pair(s) of key=value‘s (separated with |)

To be clear: I know two pairs of key=value so regex is only for matching requests containing those 2 pairs. Requests could be ordered in different way. I don’t have access to request itself, I only work on saved data (as string).

Language where regex will be used is PHP. But I don’t have access to full code, because we declare regex in web application interface.

I think I need two positive lookaheads, like (?=[^\s]*(key1=myValue1)[^\s]*){1}(?=[^\s]*(key2=myValue2)[^\s]*){1} but I can’t get it to work and clock is ticking…

  • 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-09T08:29:41+00:00Added an answer on June 9, 2026 at 8:29 am

    Use two lookaheads:

    ^(?=.*\bkey1=myValue1\b)(?=.*\bkey2=myValue2\b)
    

    The \b word boundary anchors make sure that only entire alphanumeric “words” are matched.

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

Sidebar

Related Questions

This is possibly a candidate for a one-line answer. I would like know it
Well, first I know that this question was already asked several times. But I
First, this may be marked as duplicate question, but the other questions were not
Excuse me first. because i don't know this is question is valid or not.
this is my first question here :) I know that I should not check
First, I don't know where to ask this question. Well this is programming QA
This is a two-part question: First, I am interested to know what the best
So I know this question have been asked a lot , but I don't
I know this type of question has been asked before, but I could not
I know this question has been asked countless times before, but the other threads

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.