---
title: "正则获取字符窜中的数字"
author: "13shu"
date: "2011-06-23T15:52:04Z"
tags: ["Java"]
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2011-06-23T15:52:04Z"
id: 1102580
url: "https://13shu.iteye.com/blog/1102580"
---

```
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class A {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String s = "\\d*+";
		Pattern p = Pattern.compile(s);
		Matcher m = p
				.matcher("福利彩票双色球2011071期红色球281530020122蓝色球02,其中一等奖3注,每注奖金10000000元.");
		while (m.find()) {
			String text = m.group();
			if (null != text && !"".equals(text.trim())) {
				System.out.println(text);
			}
		}
	}
	
	

}
```

 获取字符窜中数字