Python Forum
Python regex to get only numbers
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python regex to get only numbers
#2
You'll want something more like this:

regex = re.compile("(?:FEW|BKN|OVC|SCT)(\d{3})")
The digits will be in a capture group for each match. Review the Python documentation for regex groups to access them.
Reply


Messages In This Thread
Python regex to get only numbers - by tantony - Oct-09-2019, 04:39 PM
RE: Python regex to get only numbers - by stullis - Oct-09-2019, 05:12 PM
RE: Python regex to get only numbers - by tantony - Oct-09-2019, 06:57 PM
RE: Python regex to get only numbers - by snippsat - Oct-09-2019, 07:21 PM
RE: Python regex to get only numbers - by tantony - Oct-09-2019, 07:45 PM
RE: Python regex to get only numbers - by stullis - Oct-09-2019, 10:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Regex quest 2 2,433 Sep-22-2022, 03:15 AM
Last Post: quest
  Find numbers using Regex giddyhead 18 3,289 Jul-28-2022, 12:29 AM
Last Post: giddyhead
  python regex: get rid of double dot wardancer84 4 2,429 Sep-09-2021, 03:03 PM
Last Post: wardancer84
  Using Regex Expression With Isin in Python eddywinch82 0 2,325 Apr-04-2021, 06:25 PM
Last Post: eddywinch82
  Exception handling in regex using python ShruthiLS 1 2,389 May-04-2020, 08:12 AM
Last Post: anbu23
  Python the regex not getting any attributes sarath_unrelax 1 1,886 Dec-19-2019, 11:06 AM
Last Post: Larz60+
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,787 May-09-2019, 12:19 PM
Last Post: Pleiades

Forum Jump:

User Panel Messages

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