Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This method get price from text.
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Regex {
public static String toPrice(String text) {
text = text.replace(",","");
Pattern p = Pattern.compile("[\\d.]+\\d");
Matcher m = p.matcher(text);
String price = "";
while (m.find()) {
return "not found price";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment