git @ Cat's Eye Technologies Dipple / master python / unformat-smth.py
master

Tree @master (Download .tar.gz)

unformat-smth.py @masterraw · history · blame

#!/usr/bin/env python

# SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
# For more information, please refer to <https://unlicense.org/>
# SPDX-License-Identifier: Unlicense

import sys
import re

for line in sys.stdin:
    for w in re.finditer(r'(\<.*?\>|[^<\s]+)', line):
        w = w.group(1)
        w = re.sub(r'(\#|\`|\-|\(|\)|\|\=|\*)', '', w)
        if w and not w.startswith('<'):
            print w