Skip to content

Instantly share code, notes, and snippets.

@rogerpence
rogerpence / gist:8b55bef13db273c7bffa71d0d6f9cc84
Last active January 10, 2019 18:22
An old regex article
<p>Regular expressions (regex) provide a pattern matching scheme you can use to search and manipulate&nbsp;strings. Although regex has been around for almost 50 years, it is often either completely ignored or relegated to the &ldquo;will learn later&rdquo; pile by many programmers. Regex is indeed borderline witchcraft that at first glance looks like it was culled from the script of <a href="https://www.youtube.com/watch?v=Ln7WF78PolA">Plan 9 from Outer Space</a>. (It wasn&rsquo;t!).</p>
<p>There is an old programming adage that goes: &ldquo;One time I had a problem so I tried to solve it with regular expressions. Now I have two problems.&rdquo; If you&#39;re not careful, that old saying sums up regex well. If you get in a hurry&nbsp;or try to over-complicate things, regex will get you in more trouble than cheating on your taxes. But with a little effort and practice, knowing how and when to use a regular expression to solve a problem will make your code better, easier to read (really!), and easier to maintai
@rogerpence
rogerpence / main.py
Created March 5, 2020 19:44
Custom main.py for Pycco with my changes for AVR code
#!/usr/bin/env python
"""
"**Pycco**" is a Python port of [Docco](http://jashkenas.github.com/docco/):
the original quick-and-dirty, hundred-line-long, literate-programming-style
documentation generator. It produces HTML that displays your comments alongside
your code. Comments are passed through [Markdown][markdown] and
[SmartyPants][smartypants][^extensions], while code is passed through
[Pygments](http://pygments.org/) for syntax highlighting.
[markdown]: http://daringfireball.net/projects/markdown/syntax