I don't understand why it matches the last '\n':
import re
s = 'abc\t' # no
# s = 'abc\n' # yes
if re.match('^(\S+)$', s):
print 'yes'
else:
print 'no'
As far as I know, '\S' should not match '\t' or '\n', but here '\n' is matched.
I don't understand why it matches the last '\n':
import re
s = 'abc\t' # no
# s = 'abc\n' # yes
if re.match('^(\S+)$', s):
print 'yes'
else:
print 'no'
As far as I know, '\S' should not match '\t' or '\n', but here '\n' is matched.