Back to project page BarcodeTest.
The source code is released under:
Copyright (c) 2014, zhongwcool All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * R...
If you think the Android project BarcodeTest listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/** * // w ww. j a v a 2s .c o m */ package com.qr.utils; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author alex.zhong * */ public final class Parser { /** * @param args */ public static List<String> urlParser(String textInfo){ Pattern pattern = Pattern.compile("((http|ftp|https)://)[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?" ); Matcher matcher = pattern.matcher(textInfo); List<String> urlList = new ArrayList<String>(); while(matcher.find()){ urlList.add(matcher.group()); } return urlList; } public static List<String> phoneParser(String textInfo){ Pattern pattern = Pattern.compile("(?<!\\d)(?:(?:1[35]\\d{9})|(?:0[1-9]\\d{1,2}-?\\d{7,8}))(?!\\d)"); Matcher matcher = pattern.matcher(textInfo); List<String> phoneList = new ArrayList<String>(); while(matcher.find()){ phoneList.add(matcher.group()); } return phoneList; } }