this is a general question to write a regular expression to exclude only one special characters. Let’s take this example: Note that the question is not related to bullet point.
regx = r'(?<=\*\)\s)[\w\s,\.]+'
re.findall(rr, '*) Do you like, pizza, salmon and fruits? *) Yes, I like Pizza and fruits, but I dont like salmon')
['Do you like, pizza, salmon and fruits? ',
'Yes, I like Pizza and fruits, but I dont like salmon']
Here, I have to specify ,, . and ? to match correctly. In general, we can get other special characters. So, I want to include all the characters and exclude only *. I try this, but it does not work:
regx = r'(?<=\*\)\s)[\w\W^*]+'
>Solution :
Have you tried it this way?
I think all characters except * can also be specified like this [^*]. See below:
Using regex to match any character except =