Skip to main content
added 563 characters in body
Source Link
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k

Use

StringReplace[list, PunctuationCharacter -> " "] 

(* {"string1", "bla bla", "more stuff", "and more stuff"} *)

PunctuationCharacter is new in version 10.3. The 10.x updates received many new functions for text processing. In older versions I would use an explicit list of possible punctuation characters, i.e.

punctuation = Alternatives@@Characters[",.?:;'\"!-"]

I'm pretty sure I missed some.

StringReplace[list, punctuation -> " "]
(* {"string1", "bla bla", "more stuff", "and more stuff"} *)

Use

StringReplace[list, PunctuationCharacter -> " "]

Use

StringReplace[list, PunctuationCharacter -> " "] 

(* {"string1", "bla bla", "more stuff", "and more stuff"} *)

PunctuationCharacter is new in version 10.3. The 10.x updates received many new functions for text processing. In older versions I would use an explicit list of possible punctuation characters, i.e.

punctuation = Alternatives@@Characters[",.?:;'\"!-"]

I'm pretty sure I missed some.

StringReplace[list, punctuation -> " "]
(* {"string1", "bla bla", "more stuff", "and more stuff"} *)
Source Link
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k

Use

StringReplace[list, PunctuationCharacter -> " "]