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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:36:43+00:00 2026-05-25T17:36:43+00:00

I am trying to find functionality in python similar to the Ruby function scan.

  • 0

I am trying to find functionality in python similar to the Ruby function scan. My goal is to grab all the text in-between two curly braces in a list. If there are multiple pairs of curly braces in the string, I want to have multiple entries in the list.

When I run this code:

 match = re.search(r'\{(.+)\}', request.params['upsell'])
 print match.group()

I match the right text. However, what is captured includes the curly braces. I don’t want to include this text, I want to include everything in between, but not the curly braces Thanks!

  • 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-25T17:36:44+00:00Added an answer on May 25, 2026 at 5:36 pm
    re.findall(r'\{(.+?)\}', request.params['upsell'])
    

    This will return a list where each entry is the contents of a different group of curly braces. Note that this will not work for nested braces.

    The ? after the .+ will make it a lazy match (as opposed to greedy). This means that the match will stop at the first “}”, instead of continuing to match as many characters as possible and ending on the last closing brace.

    re.findall() will search through your string and find all non-overlapping matches, and return the group. Alternatively you could use re.finditer() which will iterate over Match objects, but then you would need to use match.group(1) to get only what it inside of the braces. This is also what you would need to change in your example, match.group() returns the entire match not the captured group, for that you need to put the number for the group you want.

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

Sidebar

Related Questions

I am trying to find ruby code that has commensurate functionality to these lines
Really, really trying to find a plugin that gives adds functionality to the image-resize
Trying to find a way to send a POST HTTPS request from Python to
I'm trying to implement a similar functionality to Facebook's thumbnail preview. The idea is,
I'm trying to find best free expert system, with the highest functionality. I know
Trying to find a way to execute a function within BASH after changing into
I am trying to implement find functionality in my application and for this I
I'm trying to find all customers that contain a certain sequence of letters. I
Now I've been trying to create a similar functionality as there is in Push-To-Talk
I'm trying to find some differences between these approaches. Is there any situation where

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.