Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This method get price from text.
package regex.com;
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 m.group();
}
return "not found price";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.