I am new to regular expressions and the re module in python. I wanted to form a regex pattern which helps in identifying all strings which contain at most three alphanumeric characters. Some example patterns which I want to find are :
gut
ok
aa
na
N/A
x
c
Nil
wu
No.
E
A
I
k k
H
o
K
N
Y
Top
OK了
m
| yes
N/A |
t | T
t | T
| idk
| wsq
t | T
b | n
I have prepared a regex pattern ^[^a-zA-Z\d]*([^\n]){0,3}[^a-zA-Z\d]*$ but it fails if we have a special character in between 2 alphanumeric characters.
Can someone please help with this?