0

I have a list of numbers and I want to check if a non visible character has sneaked such as a space, tab or anything else. What would be the most safe way to check non visible characters in the data? Now my list contains numbers but it could be any printed/visible character.

I tried to search for ^(\d) but it seems to find the first digit of each number which is not what expected. Also, anything similar would work only for number lists and not for any type of printable/visible data.

f f
  • 1
  • 3
  • If you're looking for whitespaces, `\s+` should be able to highlight them all. [Sample](https://regex101.com/r/ZAYMbZ/1) – M B Nov 04 '22 at 10:43

1 Answers1

1

I don't understand the tags (boost and notepad++ together). Beside that:

  • ^ is negation only inside square brackets, otherwise its meaning is the beginning of the line
  • It may be almost a duplication of this question Regex for all PRINTABLE characters in which case the regex you may look for is [\s\p{Cc}\p{Cn}\p{Cs}] with lower case p. This should find every space character (\s includes spaces, tabs, etc) and not printable characters like control characters.

For more information about characters classes for boost you may refer to the documentation at https://www.boost.org/doc/libs/1_68_0/libs/regex/doc/html/boost_regex/syntax/character_classes.html

Simone-Cu
  • 1,109
  • 8
  • 21