问题描述:

I want to grab the start of the first alphabetical characters at the beginning of the string:

||hello there -> hello there

((hello there -> hello there

I am using this code:

str = re.findall('^[^a-zA-Z]+(.*?)', str)

str gives me an array of two strings, the first string which is a blank string.

网友答案:

I think you want

re.findall('^[^a-zA-Z]*(.*)', str)
网友答案:

To be unicode compatible, use \pL wich means a letter.

^\pL

This regex ensure you that you have at least one letter at the begining of the string.

If you want to capture the rest of the string:

^\pL(.*)$
相关阅读:
Top