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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:49:15+00:00 2026-06-01T11:49:15+00:00

In the following string,how to match the words including the commas — process_str =

  • 0

In the following string,how to match the words including the commas

  1. —

    process_str = "Marry,had ,a,alittle,lamb"
    import re
    
    re.findall(r".*",process_str)
    ['Marry,had ,a,alittle,lamb', '']
    
  2. —

    process_str="192.168.1.43,Marry,had ,a,alittle,lamb11"
    
    import re
    ip_addr = re.findall(r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}",l)          
    re.findall(ip_addr,process_str1)
    

    How to find the words after the ip address excluding the first comma only
    i.e, the outout again is expected to be Marry,had ,a,alittle,lamb11

  3. In the second example above how to find if the string is ending with a digit.

  • 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-01T11:49:17+00:00Added an answer on June 1, 2026 at 11:49 am

    In the second example, you just need to capture (using ()) everything that follows the ip:

     import re
    
     s = "192.168.1.43,Marry,had ,a,alittle,lamb11"
     text = re.findall(r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3},(.*)", s)[0]
     // text now holds the string Marry,had ,a,alittle,lamb11
    

    To find out if the string ends with a digit, you can use the following:

    re.match(".*\d$", process_str)
    

    That is, you match the entire string (.*), and then backtrack to test if the last character (using $, which matches the end of the string) is a digit.

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

Sidebar

Related Questions

How can I match the three words in the following string with a Perl
I want to match and modify part of a string if following conditions are
If I want to match() a string with the following pattern: 12345678_12345678 What would
I'm trying to match the following items in the string pcode : u followed
I am wondering why the following regex does not match. string query = \1
I use the following function to filter numbers from a string (including some special
I'm trying to match the following string, without success. I've this so far. /\[([^\]]+)(\([^\)]+)/
Assuming I've been given the following string to match against: #sidebar h1 ul li{
The following code splits a string and selects all of the alphanumeric words containing
I have the following string: nothing to match <- this rocks should match as

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.