Skip to content

Instantly share code, notes, and snippets.

@ApexExpress
Last active October 8, 2023 00:59
Show Gist options
  • Save ApexExpress/24da65ec0e45793842768b0399d7436e to your computer and use it in GitHub Desktop.
Save ApexExpress/24da65ec0e45793842768b0399d7436e to your computer and use it in GitHub Desktop.
mathematrix -- symbolic tokens 100
```
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