I wanted to extract lovely and real ending with ly from sentence.
Doesn't r'\D+ly'
become 'repeat non-numeric (\D
) several times (+
), and find a pattern that ends with ly
'?
But I wonder why the result was different from r'\w+ly'
.
r'\w+ly'
thinks that even if the letter or number (\w
) is repeated many times (+
), find a pattern that ends with ly
', so I think the right result came out.
Shouldn't r'\D+ly'
also have ['lovely', 'really']
?
I'm curious
Thank you for reading.
python
Because \D
contains spaces and \w
does not contain spaces. https://regex101.com/r/W91E8U/1
564 Understanding How to Configure Google API Key
575 Uncaught (inpromise) Error on Electron: An object could not be cloned
833 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
583 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.