问题描述:
Write a function to check whether the given string starts and ends with the same character or not using regex.

测试用例:
['assert check_char("abba") == "Valid"', 'assert check_char("a") == "Valid"', 'assert check_char("abcd") == "Invalid"']

生成的代码:
import re

def check_char(s):
    if re.match(r'^(.)\w*\1$', s):
        return "Valid"
    else:
        return "Invalid"

# Test cases
assert check_char("abba") == "Valid"
assert check_char("a") == "Valid"
assert check_char("abcd") == "Invalid"