0

I have the following string of delimiters:

delimiters = " \t,;.?!-:@[](){}_*/"

I want to use the re.split() method to split words in a list. I am doing this:

new_word = re.split(' |,|\t|.|?|!|-|:|@|[|]|{|}|(|)|_|{|}|*|/',word)

I don't understand which specific delimiters need the escape character before them.

  • Why do you think you're doing something wrong? Note that `re` works with regular expressions, not just plain characters. – ForceBru Jan 30 '21 at 17:39
  • Does this answer your question? [Split string with multiple delimiters in Python](https://stackoverflow.com/questions/4998629/split-string-with-multiple-delimiters-in-python) – Le Minaw Jan 30 '21 at 17:41
  • I think I am confused about which specific delimiters need the escape character – Savage_Sun1 Jan 30 '21 at 17:52
  • It seems like you want to split on word-boundaries, so would simply be splitting on `"\\b"` – Paul M. Jan 30 '21 at 19:55

0 Answers0