0

As you can see in the following code, the "\n" at the beginning of the string matches the pattern.

In [103]: print(re.match("\n", "\ndfss"))
<_sre.SRE_Match object at 0x03904FA8>

However, if you look at the next code example:

In [102]: print(re.match("\n", "3\ndfss"))
None

you can see that this time there is no match. The difference is that '\n' is not at the beginning of the string.

Do you have any idea why there is no match in the second example?

CrazySynthax
  • 13,662
  • 34
  • 99
  • 183

0 Answers0