Last active
October 8, 2023 00:59
-
-
Save ApexExpress/24da65ec0e45793842768b0399d7436e to your computer and use it in GitHub Desktop.
mathematrix -- symbolic tokens 100
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
``` | |
import re | |
# Your list of strings | |
strings = [ | |
'! @ # $ % ^ & * ( !) ', | |
'!!', | |
'!@', | |
'!#', | |
'!$', | |
'!%', | |
'!^', | |
'!&', | |
'!*', | |
'!( @)', | |
'@!', | |
'@@', | |
'@#', | |
'@$', | |
'@%', | |
'@^', | |
'@&', | |
'@*', | |
'@( #)', | |
'#!', | |
'#@', | |
'##', | |
'#$', | |
'#%', | |
'#^', | |
'#&', | |
'#*', | |
'#( $)', | |
'$!', | |
'$@', | |
'$#', | |
'$$', | |
'$%', | |
'$^', | |
'$&', | |
'$*', | |
'$( %)', | |
'%!', | |
'%@', | |
'%#', | |
'%$', | |
'%%', | |
'%^', | |
'%&', | |
'%*', | |
'%( ^)', | |
'^!', | |
'^@', | |
'^#', | |
'^$', | |
'^%', | |
'^^', | |
'^&', | |
'^*', | |
'^( &)', | |
'&!', | |
'&@', | |
'&#', | |
'&$', | |
'&%', | |
'&^', | |
'&&', | |
'&*', | |
'&( *)', | |
'*!', | |
'*@', | |
'*#', | |
'*$', | |
'*%', | |
'*^', | |
'*&', | |
'**', | |
'*(', | |
'(! (@ (# ($ (% (^ (& (* ((' | |
] | |
# Define a regular expression pattern to match a single character or a character group | |
pattern = r'(!|@|#|\$|%|\^|&|\*|\(|!\))' | |
# Initialize a list to store the matched patterns | |
matched_patterns = [] | |
# Iterate through the strings and find all matching patterns | |
for string in strings: | |
matches = re.findall(pattern, string) | |
matched_patterns.extend(matches) | |
# Print the matched patterns | |
print(matched_patterns) | |
``` | |
``` | |
! @ # $ % ^ & * ( !) | |
!! !@ !# !$ !% !^ !& !* !( @) | |
@! @@ @# @$ @% @^ @& @* @( #) | |
#! #@ ## #$ #% #^ #& #* #( $) | |
$! $@ $# $$ $% $^ $& $* $( %) | |
%! %@ %# %$ %% %^ %& %* %( ^) | |
^! ^@ ^# ^$ ^% ^^ ^& ^* ^( &) | |
&! &@ &# &$ &% &^ && &* &( *) | |
*! *@ *# *$ *% *^ *& ** *( () | |
(! (@ (# ($ (% (^ (& (* (( !)) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment