I have the following test string:
test_str = `It isn't directed at all,' said the White Rabbit;
My current regular expression uses re.sub to filter out the punctuation so that I can do my own operations.
My current regex is re.sub(r"[^A-Za-z0-9'\s]", '', test_str)
The output from above is:
['It', "isn't", 'directed', 'at', "all'", 'said', 'the', 'White', 'Rabbit']
The error can be seen at all' when it is suppose to be storing all only.
How do you store words with 's and also ignore ' that comes after a punctuation? In this case, all,'.