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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:59:10+00:00 2026-06-13T05:59:10+00:00

I am still learning REGEX, and I’ve run into an issue … I am

  • 0

I am still learning REGEX, and I’ve run into an issue …

I am trying to separate a string that is composed of a mixture of letters and numbers that are in decimal format:

AB0.500CD1.05EF2.29

Into something like this:

list1 = AB,CD,EF

list2 = 0.500,1.05,2.29

A complication to all this is that I also have strings that look like this:

AB1CD2EF3

Which I’d also like to separate into this:

list1 = AB,CD,EF

list2 = 1,2,3

A previous inquiry yielded the following snippet,

import re
pattern = re.compile(r'([a-zA-Z]+)([0-9]+)')
for (letters, numbers) in re.findall(pattern,cmpnd):
    print numbers
    print letters

This example works fine for strings of the 2nd kind, but only “finds” the leading digit in the numbers that contain decimal places in the strings of the first kind.

I’ve attempted an approach using the following line:

pattern = re.compile(r'([a-zA-Z]+)([0-9]+(\.[0-9]))')

But this results in an error: “ValueError: too many values to unpack”

Thanks for any and all assistance!

  • 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-13T05:59:11+00:00Added an answer on June 13, 2026 at 5:59 am

    Simply add a dot to the character class containing the digits:

    pattern = re.compile(r'([a-zA-Z]+)([0-9.]+)')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm still learning a lot about PHP and string alteration is something that is
I'm still learning js and trying out the Webstorm IDE, which seems sweet (including
I'm still learning PHP Regex so I'm hoping someone can help me with what
I am still getting my head round regex and learning little by little. This
I'm still learning Backbone but it is my understanding that it should handle updating
I am still learning RegEx so I need some help on this one. Rules
I'm still learning this stuff, but for the most part, my understanding is that
Still learning yacc and flex, and ran across a scenario that the how-to's and
Still learning lxml. I discovered that sometimes I cannot get to the text of
Still learning about async-await. I bumped into examples similar to following: public async Task

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.