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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:50:16+00:00 2026-06-14T11:50:16+00:00

I have the following string from which I want to extract the q and

  • 0

I have the following string from which I want to extract the q and geocode values.

 ?since_id=261042755432763393&q=salvia&geocode=39.862712%2C-75.33958%2C10mi

I’ve tried the following regular expression.

expr = re.compile('\[\=\](.*?)\[\&\]')
vals = expr.match(str)

However, vals is None. I’m also not sure how to find something before, say, q= versus =.

  • 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-14T11:50:18+00:00Added an answer on June 14, 2026 at 11:50 am

    No need for a regex (using Python 3):

    >>> from urllib.parse import parse_qs
    >>> query = parse_qs(str[1:])
    >>> query
    {'q': ['salvia'], 'geocode': ['39.862712,-75.33958,10mi'], 'since_id': ['261042755432763393']}
    >>> query['q']
    ['salvia']
    >>> query['geocode']
    ['39.862712,-75.33958,10mi']
    

    Obviously, str contains your input.

    Since (according to your tag) you are using Python 2.7, I think you need to change the import statement to this, though:

    from urlparse import parse_qs
    

    and if you were using Python before version 2.6, the import statement is

    from cgi import parse_qs
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following string from which I want to extract gcc-4.3.2 and C
I have the following string which i would like to retrieve some values from:
I have the following C# helper class which retrieves a Json String from a
I have a class from which I want to get values from combo box
I have the following sample code which gets a list of values from a
I have the following JSON string (from wikipedia http://en.wikipedia.org/wiki/JSON ) { name:Product, properties: {
I have following syntax in my script to get email address from string. The
I have the following problem, from c++ I send huge string[] to java. huge
I have the following string Downloaded: 1 files, 8.7K in 0s (16.9 MB/s) which
I have the following data which I want to save in my DB (this

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.