我不太确定期望的输出是什么。但是,我猜我们喜欢捕获 Tai 字母,根据您的原始表达,我们可能只想添加一个简单的字符列表,用捕获组包装它,然后从左到右滑动我们想要的 Tai 字母,可能类似于:
([\u0E00-\u0E7F]+)
测试
# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"([\u0E00-\u0E7F]+)"
test_str = "engภาษาไทยที่มีสระ123!@"
matches = re.finditer(regex, test_str, re.MULTILINE | re.UNICODE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
演示
const regex = /([\u0E00-\u0E7F]+)/gmu;
const str = `engภาษาไทยที่มีสระ123!@`;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
正则表达式
如果不需要此表达式,可以在regex101.com中对其进行修改或更改。
正则表达式电路
jex.im可视化正则表达式:

参考
正则表达式接受python中的所有泰语字符和英文字母