Created
January 18, 2018 08:08
-
-
Save Steffo99/bc9c44342ecb9763338d03f9ae00e21f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3.6 | |
| import cgi | |
| import re | |
| print("Content-Type: text/html") | |
| print() | |
| print("<style>span::before { color: red; content: '('; } span::after { color: red; content: ')'; }</style>") | |
| form = cgi.FieldStorage() | |
| if form["regex"].value == "": | |
| print("<h1>No regex specified.</h1>") | |
| print(re.sub(r"(" + form["regex"].value + ")", r"<span>\1</span>", form["text"].value)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment