import re
regex = r"^[a-zA-Z0-9]{1}[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]{1}$"
test_strings = [
"abc",
"123-abc",
"abc-123",
"a-b-c-123",
"-abc",
"abc-",
"abc123-",
"1234567890123456789012345678901234567890",
]
for string in test_strings:
match = re.match(regex, string)
if match:
print(f"'{string}' is a valid string.")
else:
print(f"'{string}' is an invalid string.")
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2024-11-21 UTC。"],[],[]]