Java tutorial
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final Pattern ID_PATTERN = Pattern.compile("(@[a-zA-Z]+)"); private static String lowerCaseAttributes(String formatted) { Matcher m = ID_PATTERN.matcher(formatted); StringBuffer sb = new StringBuffer(); while (m.find()) { String text = m.group(); m.appendReplacement(sb, Matcher.quoteReplacement(text.toLowerCase())); } m.appendTail(sb); return sb.toString(); } }