Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
faster code for my code
#12
(Aug-08-2022, 12:44 AM)kucingkembar Wrote: anyway is there any regex tutorial with lots of example?

Even reading the posts here, in this Forum site, you'll find a tonne of Regex info, but (IMHO) Regex is over used. A good rule of thumb (again, IMHO) is that if you know what you're looking for, then it's not pattern matching, so why use Regex.

Four digits between zero and nine, back-to-back (such as a Year, 2022), in a string object, is pattern matching: re.search('[0-9][0-9][0-9][0-9]', dateString) as that will find any four digit number, but finding specifically the year 2022 in a string, is not pattern matching; you know what you're looking for, so I'd say the same thing with your issue: you know what you're looking for (square brackets), so it's not pattern matching.
Sig:
>>> import this

The UNIX philosophy: "Do one thing, and do it well."

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Reply


Messages In This Thread
faster code for my code - by kucingkembar - Aug-07-2022, 06:50 AM
RE: faster code for my code - by Gribouillis - Aug-07-2022, 07:27 AM
RE: faster code for my code - by kucingkembar - Aug-07-2022, 07:37 AM
RE: faster code for my code - by ndc85430 - Aug-07-2022, 07:51 AM
RE: faster code for my code - by kucingkembar - Aug-07-2022, 10:44 AM
RE: faster code for my code - by rob101 - Aug-07-2022, 12:00 PM
RE: faster code for my code - by kucingkembar - Aug-07-2022, 01:07 PM
RE: faster code for my code - by rob101 - Aug-07-2022, 01:17 PM
RE: faster code for my code - by kucingkembar - Aug-08-2022, 12:44 AM
RE: faster code for my code - by deanhystad - Aug-08-2022, 02:14 AM
RE: faster code for my code - by kucingkembar - Aug-08-2022, 04:59 AM
RE: faster code for my code - by rob101 - Aug-08-2022, 07:47 AM
RE: faster code for my code - by kucingkembar - Aug-08-2022, 09:45 AM
RE: faster code for my code - by rob101 - Aug-08-2022, 10:18 AM
RE: faster code for my code - by kucingkembar - Aug-08-2022, 01:42 PM
RE: faster code for my code - by DeaD_EyE - Aug-08-2022, 10:18 AM
RE: faster code for my code - by kucingkembar - Aug-08-2022, 01:40 PM
RE: faster code for my code - by DeaD_EyE - Aug-08-2022, 02:49 PM
RE: faster code for my code - by Gribouillis - Aug-08-2022, 04:07 PM
RE: faster code for my code - by DPaul - Aug-09-2022, 09:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 1,205 Nov-15-2023, 06:56 PM
Last Post: jst
  python multiple try except block in my code -- can we shorten code mg24 10 6,462 Nov-10-2022, 12:48 PM
Last Post: DeaD_EyE
  Putting code into a function breaks its functionality, though the code is identical! PCesarano 1 2,050 Apr-05-2021, 05:40 PM
Last Post: deanhystad
  HackerRank Problem: Code works on VS Code but not on the HackerRank site Pnerd 3 2,756 Feb-28-2021, 07:12 PM
Last Post: Pnerd
  Converting SQL Code To Python Code Query eddywinch82 13 33,026 Feb-15-2020, 06:42 PM
Last Post: buran
  how can I improve the code to get it faster? aquerci 2 1,772 Feb-15-2020, 02:52 PM
Last Post: aquerci
  code not writing to projNameVal portion of code. umkc1 1 1,716 Feb-05-2020, 10:05 PM
Last Post: Larz60+
  Simple code works in Jupyter but not VS Code Matt_O 2 3,989 Nov-17-2019, 01:15 AM
Last Post: Matt_O
  How does the code run? My code wrong? jollydragon 0 1,769 Oct-10-2019, 06:24 AM
Last Post: jollydragon
  Can someone please help me convert this simple C ROT cipher code to Python code? boohoo9 5 3,540 Jun-14-2019, 03:02 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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