← Back to challenges

RegEx VIII-B: Digit Character Class

PythonHardregexlanguage_fundamentalsformatting

Instructions

Write the regular expression that will match all non-digit characters of a string. Use the character class \D in your expression.

Example

txt = "242Innokodakademija2345can3443be3254324addictive!"
pattern = "yourregularexpressionhere"

" ".join(re.findall(pattern, txt)) ➞ "Innokodakademija can be addictive!"

Notes

  • You don't need to write a function, just the pattern.

  • Do not remove import re from the code.

  • You can find all the challenges of this series in my Basic RegEx collection.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Volume of a Spherical Shell