Prepare > Regex > Introduction > Matching Specific String
2023. 10. 5. 19:49ㆍHackerRank-Python/Regex
문제
Task
You have a test string . Your task is to match the string hackerrank. This is case sensitive.
Note
This is a regex only challenge. You are not required to write code.
You only have to fill in the regex pattern in the blank (_________).
=> 빈칸에 정규표현식을 넣어, 문자열 S에 hackerrank 가 몇 번 나오는지 찾아라
코드
Regex_Pattern = r'hackerrank' # Do not delete 'r'.
import re
Test_String = input()
match = re.findall(Regex_Pattern, Test_String)
print("Number of matches :", len(match))