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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:22:47+00:00 2026-06-15T03:22:47+00:00

My regex code works well with second variable, the ([^&]+)(&.*) which is after myvar=

  • 0

My regex code works well with second variable, the ([^&]+)(&.*) which is after myvar= , but i can’t get the 3rd, which is after foo= (same as 2nd).

RewriteCond %{ENV:REDIRECT_STATUS} ^$

RewriteCond %{QUERY_STRING} ^(.*&)?myvar=([^&]+)(&.*)?&foo=([^&]+)(&.*) [NC]

RewriteRule ^(index\.php)?$ /site/myvar/%2/%3/? [R=301,L]

That outputs the url as follows:

http://localhost/site/myvar/15//

So how to output the 3rd variable between the last 2 backslashes?

  • 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-15T03:22:49+00:00Added an answer on June 15, 2026 at 3:22 am

    What you want is the fourth capture, not the third. The third one is (&.*) even if that is empty. To determine the number, you simply count opening parentheses from left to right.

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

Sidebar

Related Questions

Hi I am integrating the watermark code http://koivi.com/php-gd-image-watermark/ This script works well. But I
Below code works well, its able to replace any tag it find with a
the following code (in the main thread) works well, I grep some files and
I am trying to use std::regex in a C++11 piece of code, but it
I have the following code which works perfect in Chrome, IE8, and FF. However,
I've got the following code: Regex.Replace(text, words.ToString(), <dfn title=\ + this.FindDefinition($0) + \>$0</dfn>, RegexOptions.IgnoreCase
I am aiming for regex code to grab phone number and remove unneeded characters.
Here's my regex code: preg_match_all('/background[-image]*:[\s]*url\([|\']+(.*)[|\']+\)/', $css, $matches, PREG_SET_ORDER); It looks for CSS that looks
I'm having trouble with some Regex code while scraping YouTube playlist pages. It mostly
In boost 1.48.0 I find this in the regex code (boost/regex/v4/ w32_regex_traits.hpp ): w32_regex_traits()

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.