0

can we use spacebar in pattern and match with re module

import re pattern = r"Hi" if re.match(pattern, "baidya Hi"): print ("Match") else: print ("Not Match")

22nd Jan 2017, 3:31 PM
Biswascoder
Biswascoder - avatar
1 Respuesta
+ 1
You can use the special class char \s in regEx, which match all espacement characters ( normal space, tabulation, new line, and so on ), or use a custom class [ ] as well as the space char itself ( it's not a reserved char, unlike the dot '.' wich as the signification of 'whatever char' and need to be escaped )
22nd Jan 2017, 3:41 PM
visph
visph - avatar