Java tutorial
import java.io.BufferedReader; import java.io.FileReader; import java.util.regex.Pattern; public class Main { private static final Pattern UCODE_PATTERN = Pattern.compile("\\\\u[0-9a-fA-F]{4}"); public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new FileReader("ravi.txt")); while (true) { String line = br.readLine(); if (line == null) break; if (!UCODE_PATTERN.matcher(line).matches()) { System.err.println("Bad input: " + line); } else { String hex = line.substring(2, 6); int number = Integer.parseInt(hex, 16); System.out.println(hex + " -> " + ((char) number)); } } } }