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"]],["最后更新时间 (UTC):2024-11-22。"],[],[]]