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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:57:55+00:00 2026-06-18T06:57:55+00:00

I am trying to search string pattern using regular expression But since I am

  • 0

I am trying to search string pattern using regular expression

But since I am very new to regular expression I would like to ask some advice on search pattern

So, I would like to find a line which has ‘value’ as below
value can be both numbers and alphabets

Name (value)

I tried to use pattern

re.search(r"Name \([a-zA-Z0-9]\)", line)

But it doesn’t seem to find as I expected.

How should I write search pattern?
Thank you!

  • 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-18T06:57:57+00:00Added an answer on June 18, 2026 at 6:57 am

    Your expression is fine but your character group lacks a quantifier:

    re.search(r"Name \([a-zA-Z0-9]+\)", line)
    

    The + means “at least one of those”. If you don’t put a quantifier it means only one of the mentioned characters may occur. Possible quantifiers are:

    • + for one or more,
    • ? for at most one and
    • * for any number of those
    • {x,y} works as well, meaning at least x, but at most y characters

    And the quantifier always refers to what you place right before it, which might be a single character or a character group enclosed in [].

    Edit: As mentioned in the comments by root you might want to look at \w, which is a short notation for “all word characters”. It includes all letters and digits, as well as the underscore and maybe special characters if they are specially defined by the current locale.

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

Sidebar

Related Questions

I'm trying to match cases with regular expression to search and replace some text
I'm trying to search through a Word document and replace a specific string (Using
I'm trying to implement a Search-Function using c++ and libpqxx. But I've got the
I am trying to search a string for email addresses, but my regex does
I am trying to find some rates in a table using Regular Expressions that
I'm trying to open a webpage using urllib.request.urlopen() then search it with regular expressions,
I'm trying to make a simple substring search using the brute force technique but
I'm trying to search a string in PHP using preg_match() , to return a
I'm trying to search for a string that has 6 digits, but no more,
I'm trying to work out a regex pattern to search a string for a

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.