---
title: "用正则表达式替换手机号码前缀86"
author: "plane"
date: "2009-11-25T09:24:30Z"
tags: []
slug: "86"
draft: false
lastmod: "2009-11-25T09:24:48Z"
id: 525665
url: "https://plane.iteye.com/blog/525665"
---

```java

            Pattern p2 = Pattern.compile("^((\\+{0,1}0{0,2}86){0,1})");
            Matcher m2 = p2.matcher(phoneNum);
            StringBuffer sb = new StringBuffer();
            while (m2.find())
            {
                m2.appendReplacement(sb, "");
            }
            m2.appendTail(sb);
            return sb.toString();

```