3

Until now I use these two substitutions before printing "$string" to the terminal.

$string =~ s/\p{Space}/ /g;
$string =~ s/\p{Cntrl}//g;

Is there something that I should consider, when I replace the first two substitutions with the following two?

$string =~ s/\p{Space}/ /g;
$string =~ s/\P{Print}//g;
nwellnhof
  • 32,319
  • 7
  • 89
  • 113
sid_com
  • 24,137
  • 26
  • 96
  • 187

1 Answers1

4

See this question. There are two code points that are neither control nor printable characters: U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR. But both of them are space characters, so your two substitutions should be equivalent.

Community
  • 1
  • 1
nwellnhof
  • 32,319
  • 7
  • 89
  • 113