16
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 04 Apr 2025
16 points (94.4% liked)
Python
7010 readers
2 users here now
Welcome to the Python community on the programming.dev Lemmy instance!
📅 Events
Past
November 2023
- PyCon Ireland 2023, 11-12th
- PyData Tel Aviv 2023 14th
October 2023
- PyConES Canarias 2023, 6-8th
- DjangoCon US 2023, 16-20th (!django 💬)
July 2023
- PyDelhi Meetup, 2nd
- PyCon Israel, 4-5th
- DFW Pythoneers, 6th
- Django Girls Abraka, 6-7th
- SciPy 2023 10-16th, Austin
- IndyPy, 11th
- Leipzig Python User Group, 11th
- Austin Python, 12th
- EuroPython 2023, 17-23rd
- Austin Python: Evening of Coding, 18th
- PyHEP.dev 2023 - "Python in HEP" Developer's Workshop, 25th
August 2023
- PyLadies Dublin, 15th
- EuroSciPy 2023, 14-18th
September 2023
- PyData Amsterdam, 14-16th
- PyCon UK, 22nd - 25th
🐍 Python project:
- Python
- Documentation
- News & Blog
- Python Planet blog aggregator
💓 Python Community:
- #python IRC for general questions
- #python-dev IRC for CPython developers
- PySlackers Slack channel
- Python Discord server
- Python Weekly newsletters
- Mailing lists
- Forum
✨ Python Ecosystem:
🌌 Fediverse
Communities
- #python on Mastodon
- c/django on programming.dev
- c/pythorhead on lemmy.dbzer0.com
Projects
- Pythörhead: a Python library for interacting with Lemmy
- Plemmy: a Python package for accessing the Lemmy API
- pylemmy pylemmy enables simple access to Lemmy's API with Python
- mastodon.py, a Python wrapper for the Mastodon API
Feeds
founded 2 years ago
MODERATORS
I found a regex checker and it helped so much thank you for the suggestion! I think I better understand what's going on and was able to use that to modify it to work closer to how I want. Currently I have
"#[^\s#][^\s" + string.punctuation + "#]*"
So what I think is going on is it looks for
#
followed by not whitespace or another#
(before it was matching on headers with multiple pound signs). Then keep looking until it runs into a whitespace, punctuation, another # (in the case of multiple tags) for as many characters as needed.My use case is to be able to turn the tags into links to pages with a list of pages including that tag. What I do is blindly replace the tag to where a page should exist, log the tag, and later gather up all the found tags to make the pages with lists. The punctuation was because I had some tags in weird places like the end of sentences that was adding a period or comma to it and making a unique tag (like
#Homeworld
at the top of a file vs.Find better tag than #Homeworld.
as a note)Excellent! Indeed, I'd completely forgot about H2, H3, and so on, so I'm glad you found it comfortable to figure that out!
I read Mastering Regular Expressions about 25 years ago and it's one of the best and simplest investments I ever made in my own programming practice. Regex never goes out of style.
Enjoy!