2 ms·
re.match('^bob$', 'bob') → yes re.match('^bob$', 'bobs') → no Most people would expect 'bob\n' not to match, because I used '$' and it has an extra character
by iainmerrick 3y ago
re.match('^bob$', 'bob') → yes
re.match('^bob$', 'bobs') → no
Most people would expect 'bob\n' not to match, because I used '$' and it has an extra character at the end, just like 'bobs'. In Python it does match because '\n' is a special case.
- rerdavies 3y ago... for some arbitrary definition of "most people".
- iainmerrick 3y agoThat’s true, probably fewer than ten million people in the world would have an opinion one way or the other. :)