Use concise character class syntax '\d' instead of '[0-9]'.sonarlint(python:S6353)

If your question is about SonarLint in the IntelliJ Platform, VS Code, Visual Studio, or Eclipse, please post it in that sub-category.

Otherwise, please provide:

  • Operating system:windows 10
  • IDE name and flavor/env:VS code

And a thorough description of the problem / question:
[bB][0-9]{1,6}$" - not allowing 0-9 forcing me to use sonarlint(python:S6353). if i change 0-0 to \d entire validation fails

Hey there.

Can you include a specific code sample that demonstrates the false-positive?

Working expected

v=B345612
re.compile(r"[bB][0-9]{1,6}$").match(v)
# [ā€˜\dā€™ instead of ā€˜[0-9]ā€™.sonarlint(python:S6353) ] - fails
v=B345612
re.compile(r"[bB][/d]{1,6}$").match(v)

You appear to be using /d in your regex instead of the suggested \d. The direction of the slash makes all the difference. :slight_smile:

Yep, thanks