
String tagvalue =
I've above string and I need to extract the value of 1- fname 2- lname 3- email.
Please help me the best way to extract these value using regx or any string handling concept.
I'm trying
Pattern fnamepat = Pattern.compile("fname=\"([^<>]+)\" "); Matcher fmatch = fnamepat.matcher(persontag); if(f_match.find()) { String fname = fmatch.group(1); System.out.println("FIRST NAME FOUND :: "+f_name); }
but it is giving me :
FIRST NAME FOUND :: Prof Ammar" lname="Al-Chalabi" email="ammar.al-chalabi@kcl.ac.uk

//Please ignore previous post..
String tagvalue = person fname="Prof Ammar" lname="Al-Chalabi"
email="ammar.al-chalabi@kcl.ac.uk" author="yes">
//I've above string and I need to extract the value of
//1- fname
//2- lname
//3- email.
//Please help me the best way to extract these value
//using regx or any string handling concept.
//I'm trying
Pattern f_name_pat = Pattern.compile("fname=\"([^<>]+)\" ");
Matcher f_match = f_name_pat.matcher(person_tag);
if(f_match.find())
{
String f_name = f_match.group(1);
System.out.println("FIRST NAME FOUND :: "+f_name);
}
//but it is giving me :
//FIRST NAME FOUND :: Prof Ammar" lname="Al-Chalabi"
//email="ammar.al-chalabi@kcl.ac.uk
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.