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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:07:56+00:00 2026-05-21T00:07:56+00:00

I have a querystring like this: s = ‘word1 AND word2 word3 OR word4

  • 0

I have a querystring like this:

s = 'word1 AND word2 word3 OR "word4 word5" OR word6 AND word7 word8'

I need to find all words or phrases within OR and AND, so the results will be a list like this (preferably without the spaces between AND/OR and the word/phrase):

l = ['word1', 'word2 word3', '"word4 word5"', 'word6', 'word7 word8']

I’ve tried messing around with regular expressions but could’t find a way to do this.

Thanks for the help.

  • 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-21T00:07:57+00:00Added an answer on May 21, 2026 at 12:07 am

    If you want to use regexps, re.split should do it:

    re.split(' OR | AND ', 'word1 AND word2 word3 OR "word4 word5" OR word6 AND word7 word8')
    ['word1', 'word2 word3', '"word4 word5"', 'word6', 'word7 word8']
    

    If you need a bigger hammer, you could check out something like pyparsing:
    http://pyparsing.wikispaces.com/file/view/searchparser.py

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

Sidebar

Related Questions

If I have a query like this: String Category = HttpContext.Current.Request.QueryString[Product].ToString(); IQueryable<ItemFile> pressReleases =
I have a QS like this: Request.QueryString = Id=443f0cb9&Num=9232323 Now I want to add
how can i modified the querystring? I have capture the query string like this
how can i use request.querystring in asp.net.i have a linkbutton and this is in
I have a large querystring like http://terra.cic.local/web/index.cfm//pm/uebersicht?sucheAufgeklappt=was%2Cwie%2Cwohin%2Cwann%2Cwer&sucheVon=&sucheBis=&sucheIstErsteSeiteAnzahlProdukteErmitteln=false&sucheIDReiseart=26&sucheHotelart=1081&sucheHotelart=1082&sucheIDLand=347&sucheRegion=214&sucheIstZeitlichFlexibel=true&sucheDauer=&sucheAnzahlErwachsene=2&sucheAnzahlKinder=0&sucheAnzahlPersonen=2&sucheAnzahlSchlafzimmer=&sucheEntfernungStrand=&sucheEntfernungSkilift= this link will be pasted displayed in
I have a basic .ASP page like this, which when hit redirects the user
I have a .net application (c#) that goes something like this public partial class
I have a repeater and it looks like this heading1 A B C D
i have a datalist in my aspx like this: <asp:DataList ID=dlSubs runat=server CellPadding=0 CellSpacing=5
I'm calling the php code from ajax like this: ajaxRequest.open(GET, func.php + queryString, true);

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.