我想抓住字符串开头的第一个字母字符的开头:
||hello there -> hello there
((hello there -> hello there
我正在使用此代码:
str = re.findall('^[^a-zA-Z]+(.*?)', str)
str给了我一个包含两个字符串的数组,第一个字符串是一个空字符串。
答案 0 :(得分:2)
我想你想要
re.findall('^[^a-zA-Z]*(.*)', str)
答案 1 :(得分:0)
要兼容unicode,请使用\pL
表示信件。
^\pL
此正则表达式确保您在字符串的开头至少有一个字母。
如果你想捕获字符串的其余部分:
^\pL(.*)$