Python Forum
trying to recall a regex for re.split()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
trying to recall a regex for re.split()
#10
(May-18-2022, 06:29 PM)Gribouillis Wrote: By the way, in order to specify the problem clearly, it would be good to write a complete syntax of the strings that you want to be able to parse.
i'm trying to generalize this to make a function. the first part is a decimal number, although i may, someday, try to extend that to hexadecimal (including float). the 2nd part is any string of characters that could be taken as a unit suffix like 'km' or 'Hz'. the intended function splits it into a converted value and a string or raises an exception if something is bad. i hadn't thought about scientific notation but i should do that just in case someone gives '1.25E-20watts'. right now, it's about making that function. then i will be making a few app scripts that take these from command line arguments, using that function.

i wasn't thinking of this as "parsing" although i can understand that it is, even if just a small amount (kind of like str.split() is).
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: trying to recall a regex for re.split() - by Skaperen - May-18-2022, 10:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Split pdf in pypdf based upon file regex standenman 1 2,307 Feb-03-2023, 12:01 PM
Last Post: SpongeB0B
  recall cool_person 1 1,106 May-07-2022, 08:04 AM
Last Post: menator01

Forum Jump:

User Panel Messages

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