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

The Archive Base Latest Questions

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

I have an alphanumeric code that looks like: PRODUCTNAME600COUPON50 where PRODUCTNAME is a variable

  • 0

I have an alphanumeric code that looks like:

"PRODUCTNAME600COUPON50"

where PRODUCTNAME is a variable of inconsistent length

I want to be able to extract the integer values of the string into a list- in this case [600, 50].

I’m looking for a slick Pythonic way to do it- I started with this solution for finding the index of the first number within a string, but that falls short in this case.

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

    use the following regex:

    In [67]: strs="PRODUCTNAME600COUPON50"
    
    In [68]: re.findall(r'\d+',strs)
    Out[68]: ['600', '50']
    

    to get integers:

    In [69]: map(int,re.findall(r'\d+',strs))
    Out[69]: [600, 50]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that should strip all non-alphanumeric characters (excluding hyphens) from
I have this code that replaces all non alphanumeric characters with - char. return
I have an alphanumeric string like below, $string_1 = a4nas60dj71wiena15sdl1131kg12b and would like to
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
I have below code in vb.net for validating alphanumeric characters, It is working fine
I have the following bit of code in my htaccess that will allow a
I have a employee, product and product odometer tables which looks like below Each
I have several strings that look like the following: +H124005992014011/1527399999999I05Z +H7039700000001/$99999999I051 +K122005962050171/120911234C117 I need
I have the following code that saves the users sketch data to a file...
For eg., i have alphanumeric string 'ABCDEF 0 0.450' and i need to get

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.