Python Forum
converting a substring of digits and keep what follows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
converting a substring of digits and keep what follows
#4
(Apr-21-2018, 02:10 PM)ljmetzger Wrote: There is a great online regex tester https://regex101.com/#python courtesy of DeaD_EyE which even generates Python code.

Lewis
copy and paste does not work on that page ... at least pasting the RE does not work. typing works, but i'm not very accurate at typing REs other people wrote. at least the forum post edit form lets me paste in ... (\d+(?:\.\d*)?|\.\d+)

it look like that regex should work for me. i can just pop off the first element from the list an loop through the rest popping them as i go, 2 at a time, a number and a multiplier suffix {'day':86400,...}.

maybe the next thing to ask for is a literal arithmetic expression evaluator (have done that in C, too). then somehow combine them so i can do things like '(1week3days)/5' and get 172800.

or maybe a general purpose units suffix thing.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: converting a substring of digits and keep what follows - by Skaperen - Apr-22-2018, 02:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  extract substring from a string before a word !! evilcode1 3 1,876 Nov-08-2023, 12:18 AM
Last Post: evilcode1
  [SOLVED] [regex] Why isn't possible substring ignored? Winfried 4 2,100 Apr-08-2023, 06:36 PM
Last Post: Winfried
  ValueError: substring not found nby2001 4 11,144 Aug-08-2022, 11:16 AM
Last Post: rob101
  Match substring using regex Pavel_47 6 2,606 Jul-18-2022, 07:46 AM
Last Post: Pavel_47
  Substring Counting shelbyahn 4 7,430 Jan-13-2022, 10:08 AM
Last Post: krisputas
  Python Substring muzikman 4 3,358 Dec-01-2020, 03:07 PM
Last Post: deanhystad
  Single digits seem to be greater than double digits Frosty_GM 4 5,221 Nov-20-2020, 10:13 AM
Last Post: DeaD_EyE
  Removing items from list if containing a substring pythonnewbie138 2 2,963 Aug-27-2020, 10:20 PM
Last Post: pythonnewbie138
  Substring and If then Condition to create column Chandan 2 3,110 Jan-23-2020, 08:40 AM
Last Post: buran
  ValueError: substring not found hoangthai10788 2 5,849 Sep-23-2019, 05:34 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020