0
I need an example...
Could anyone give an example of one question inthe python course?.... that question is in regular expresions/simple metacharacters, is the second one, i need to see a "no new lines" example of that not matching(sorry for my inglish thia is not my native language)
2 Réponses
+ 2
What would '....' match?
- Any four character string with no new lines.
Here's an example of that:
import re
pattern = r"...."
if re.match(pattern, "abcd"):
print("Match 1")
if re.match(pattern, "1234"):
print("Match 2")
# New line character is "\n"
if re.match(pattern, "abc\n"):
print("Match 3")
if re.match(pattern, "amp;@?"):
print("Match 4")
Output:
Match 1
Match 2
Match 4
0
Thanks!!!