-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added better regex for style and jupterlab
- Loading branch information
1 parent
f6abe07
commit e82b009
Showing
3 changed files
with
196 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 17, | ||
"id": "9c507e95-0326-4cc4-9685-72a217993db8", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"(?!jQuery.)(.*\\bdark).*|(?!jQuery.)(.*\\bDARK).*|(?!jQuery.)(.*\\bDark).*\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"tag = \"dark\"\n", | ||
"\n", | ||
"original_regex_tag = \"(?!jQuery.)(.*\\\\b{}).*\"\n", | ||
"regex_tag = original_regex_tag.format(tag)\n", | ||
"for f in [\"upper\", \"title\"]:\n", | ||
" altered_regex = original_regex_tag.format(getattr(tag, f)())\n", | ||
" regex_tag += f\"|{altered_regex}\"\n", | ||
"\n", | ||
"print(regex_tag)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "3d201729-3e92-4e57-8c1b-c420c6506625", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"ename": "SyntaxError", | ||
"evalue": "invalid syntax (2522250776.py, line 3)", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[0;36m File \u001b[0;32m\"/tmp/ipykernel_37576/2522250776.py\"\u001b[0;36m, line \u001b[0;32m3\u001b[0m\n\u001b[0;31m regex_tag += f\"|{regex_tag.format(getattr(tag, \"upper\")())}\"\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"regex_tag = \"this{}\"\n", | ||
"\n", | ||
"regex_tag += f\"|{regex_tag.format(getattr(tag, \"upper\")())}\"\n", | ||
"\n", | ||
"print(regex_tag)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"id": "8a0f5e8a-79c4-46d5-9fda-813b93f97184", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"thisTHISthisTHIS\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"tag = \"this\"\n", | ||
"\n", | ||
"getattr(tag, \"upper\")()\n", | ||
"\n", | ||
"regex_tag = \"this{}\".format(getattr(tag, \"upper\")())\n", | ||
"\n", | ||
"regex_tag += f\"{regex_tag}\"\n", | ||
"\n", | ||
"print(regex_tag)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 15, | ||
"id": "b5d11363-60c8-4609-bfaa-2af4529825cb", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"upper\n", | ||
"this\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"for f in [\"upper\", \"this\"]:\n", | ||
" print(f)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains 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
This file contains 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