正则表达式从[\ W_]中排除μ

时间:2017-04-12 08:11:22

标签: java regex

我必须替换所有不是字母数字的字符(包括“_”),并且我取得了成功:

def extract_nodes():
    labels = []
    ids = []
    results = {}
    for i in json.load(open('/home/ubuntu/slcakbot_openNMS/CLEAR/out.txt'))["node"]:
        try:
          socket.inet_aton(i["label"])
          print(i["label"])
          labels.append(i["label"])
          print(i["id"])
          ids.append(i["id"])
          #return { 'ip': i["label"], 'id': i["id"]}  #  i need to return these values

        except Exception as e:
          pass
    results['ip']=labels
    results['id']=ids
    return results

现在我需要从那个正则表达式中排除希腊字符,特别是μ。

我对“^”没有成功,我该怎么做?

非常感谢

1 个答案:

答案 0 :(得分:0)

你可以试试这个:

[^a-zA-Z0-9-()/\s\p{IsGreekandCoptic}]
相关问题