Regex in Java (Pattern, Matcher)
Në shqip: Regex në Java
ShpjegimiSQ
Në Java, shprehjet e rregullta përdoren me Pattern dhe Matcher, ose shkurt me String.matches() dhe replaceAll(). Kujdes: \ shkruhet dy herë brenda thonjëzave: "\\d+".
EnglishEN
In Java, regular expressions are used with Pattern and Matcher, or briefly with String.matches() and replaceAll(). Careful: \ is written twice inside quotes: "\\d+".
Si ta mendosh
Si ta kërkosh me lupë çdo numër telefoni në një faqe.
Lexoje në anglisht
Like hunting for every phone number on a page with a magnifying glass.
Shembull kodijava
Pattern p = Pattern.compile("0\\d{2} \\d{3} \\d{3}");
Matcher m = p.matcher("Thirr 044 123 456");
if (m.find()) System.out.println(m.group());