Regex, character classes | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

Regex, character classes

I want to write a simple regular expression in Python that extracts a number from HTML. For example 110 The HTML sample is as follows: number is <b>123</b>

24th Feb 2021, 10:09 PM
Roza Simonyan
Roza  Simonyan - avatar
1 Resposta
+ 6
the class character for digit (0-9) is r"\d"... as you want consecutives digits, you must append 'plus' sign: num = r"\d+"
24th Feb 2021, 10:19 PM
visph
visph - avatar