Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Pattern matching

Have Programming Question? Ask it here!
 
 
 


Naveen Saini
Pattern matching
1 Answer(s)      2 years and 7 months ago
Posted in : Java Beginners


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


Advertisement
View Answers

January 18, 2012 at 6:20 PM


//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



Related Tutorials/Questions & Answers:
Pattern Matching
Pattern Matching  hello, What operator performs pattern matching?   hii, The "LIKE" operator performs the pattern matching in SQL
Pattern matching
Pattern matching  String tagvalue = I've above string and I need... Pattern fnamepat = Pattern.compile("fname=\"([^<>]+)\" "); Matcher fmatch... or any string handling concept. I'm trying Pattern fnamepat = Pattern.compile
Advertisements
pattern matching --four way technique........brute force algorithm
pattern matching - four way technique  Hi, here's my question.. I am trying to implement pattern matching using brute force algorithm where I am trying to apply four way technique to search a given pattern in a text.in
Matching Pattern using Regularexpression
Matching Pattern using Regularexpression       This Example describe the way to match a pattern with the text by using Regularexpression.The steps involved in matching a pattern
Matching Case
Matching Case  Hi, i want some code for matching case from an text file. i.e if i give an query called Java from the user,i need to get an output searching the text file all the names in that without case sensitive
pattern
of different sizes. The size of each pattern is determined by the number of columns or rows. For example, a pattern of size 5 has 5 columns and 5 rows. Each pattern is made of character $ and a digit, which shows the size. The size must
Pattern
Pattern  How to print this pattern in Java please help me A AC ACE ACEG ACEGI The program should be right to left
pattern
pattern  1 3 1 5 3 1 7 5 3 1 9 7 5 3   Here is a number pattern example. 1 3 1 5 3 1 7 5 3 1 9 7 5 3 1 class Pattern{ public static void main(String args[]){ for(int i=1;i<=9;i
Pattern
Pattern  1234321 123 321 12 21 1 1 please,give me this pattern in java   class Sixth_1 { public static void main(String args...; } } }   Here is a number pattern class Pattern{ public
Three Way Matching
Three Way Matching  hello, What is Three Way Matching?   hii, In Three way matching the following documents are compare:- Purchase order Receipt of Items/Packing slip Invoice
Fingeprint matching in java application
Fingeprint matching in java application  I am developing a java application which require fingerprint identification and verification. It is a webservice application. following considration we have to take in to mind. 1. if I am
matching database again - Java Beginners
matching database again  Dear experts, So happy I get through this ask a question page again. Thank God. I want to say "A BIG THANK YOU" for helping me about the matching codes. It is working now after fine tuning
pattern printing
pattern printing  
Design pattern
Design pattern  explain factory pattern
Pattern Making
Pattern Making  how to print this pattern in java? * * * * * * * * * * * * * * * * * It is just an example
pattern program
pattern program  can some one plz help me to wright the logic for the following pattern abcdcba abc cba ab ba a a ab ba abc cba abcdcba
Java pattern
Java pattern  Write a Java program that outputs the following pattern. 1 21 321 4321 54321 654321
Re: XML SCHEMA MATCHING doubt's - XML
Re: XML SCHEMA MATCHING doubt's  how to store xml file in database? which database require to store xml file? how to connect xml with java
Re: XML SCHEMA MATCHING doubt's - XML
Re: XML SCHEMA MATCHING doubt's  how to store xml file in database? which database require to store xml file? how to connect xml with java
pattern matcher
pattern matcher  i want a number in a specific range in pattern matcher..for example a number should only be in the range of 6-9 digits... = tf.getText(); Pattern pattern = Pattern.compile("\\d{10}"); Matcher matcher
pattern program
pattern program  can any 1 print the following pattern in java .plz give the code.and yes thank u so much for answering my 2 other questions.had i... before.anyways the pattern goes like this abcdcba abc cba ab ba a a ab ba abc abc
pattern program
pattern program  13579 1357 135 13 1 pattern program in java   Here is your Example:- package Compare; public class PatternDemo { public static void main(String [] args){ int c=10; for(int i=0;i<
Code for Pattern
Code for Pattern   1 23 345 5678 891011 Please write the code of above program and please do not use in this string tokennizer, string buffer etc i mean to say that please use very simple method
java matching array of integers - Java Beginners
java matching array of integers  am doing my project regarding clones in java. in my coding a java file is to be read and converted into tokens. each token is assigned a vlaue in integers and stored in an array. the consecutive
Matching Zip code using regular expression
Matching Zip code using regular expression       This Example describes the way of matching Zip... Matching_Zipcode.java. The steps involved in program Matching_Zipcode.java
Coder for Pattern
Coder for Pattern  1 12 123 1234 12345 please write the program of above pattern and do not use string tokennizer string buffer i mean to say that please use very simple method Thanks   public class PatternExample
pattern generation
pattern generation  write a program to print pattern shown below 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9   Here is an example of number spiral. public class NumberSpiral{ public
Java Servlet - matching 2 databases - Java Beginners
Java Servlet - matching 2 databases  Dear Experts, I have 2 tables in a database, parents and memberparticulars resepectively. parents... "A BIG THANK YOU" for helping me about the matching codes. It is working now after
how to make this pattern???
how to make this pattern???  how to make following pattern in javascript
Greedy and Non-Greedy Matching in a Regular Expression
Greedy and Non-Greedy Matching in a Regular Expression... a string in the given string through the Greedy and Non-Greedy way of matching. Here you can learn about the Greedy and Non-Greedy way of matching the word
Mysql Date like
Mysql Date like       The Like Operator is used in pattern matching by comparison with character... like '2008-12-20'.The like pattern is used in pattern matching by comparing
what is the logic of this pattern?
what is the logic of this pattern?   1 121 12321 1234321
What is static factory pattern?
What is static factory pattern?  Hello, please tell me what is static factory pattern? Thank you..   Dear friend, you can go through the following links to better understand the static factory pattern - Factory
Mysql Like Operator
Mysql Like Operator       Mysql Like is used to retrieve the records on the basis of pattern matching... named employee1 using like: Now you want to return only those pattern matching
Mysql Like Operator
of pattern matching in select query. The like comparison Operator in SQL allows you... from Table named employee1 using like: Now you want to return only those pattern matching records inside the like comparison operator from table'employee1
Design Pattern
Design Pattern       ?Pattern? word suggests a series of events occurring in a definite order... a pattern to tackle that particular problem. In a broad spectrum, it can be said
Design Pattern - JDBC
Design Pattern  what is adaptar design pattern The Adapter pattern is used so that two unrelated interfaces can work together. The joining between them is called an Adapter  The Adapter pattern is used so that two
Design Pattern in flex
Design Pattern in flex  Hi.... I want to know about What design patterns have you used? in Actionscript and java? please give me the name of this design pattern... Thanks   Ans: Singleton design pattern is used
pattern used in hibernate.
pattern used in hibernate.  how many design patterns are used in hibernate 3? please also mention the name of those design pattern. Thanks, sudhil mishra
Mysql like syntax
Mysql like syntax       Mysql Like is used to retrieve the records on the basis of pattern matching... pattern matching records inside the like comparison operator from
Mysql like syntax
of pattern matching in select query. The like comparison Operator in SQL allows you... only those pattern matching records inside the like comparison operator from
singleton pattern - Java Beginners
singleton pattern  how i use singleton pattern in my web aplication project.plz give an example.its urgent
J2EE Singleton Pattern - Design Pattern Tutorials
J2EE Singleton Pattern Singleton Design Pattern This design pattern governs the object instantiation of Object in Java. This design pattern is used when...; } } The singleton design pattern is used with the conjunction with the factory
draw this pattern of swastic.
draw this pattern of swastic.  last time i had asked swastic pattern but u had used array i want use only for loop please not use array...(" "); }}} please draw this pattern with explation i.e for understand loop
draw this pattern of swastic.
draw this pattern of swastic.  last time i had asked swastic pattern but u had used array i want use only for loop please not use array...(" "); }}} please draw this pattern with explation i.e for understand loop
logic for pattern program
logic for pattern program  what's the logic for create pattern program how can i create any pattern program with in minute. like this 123454321 * 1234 4321 *** 123 321 ***** 12 21 *** 1 1 * 123321
pattern java example
pattern java example  how to print this 1 2 6 3 7 10 4 8 11 13 5 9 12 14 15
pls answer the Trangle pattern
pls answer the Trangle pattern    a b c d e b c d e c d e d e e Please answer and give the code for above triangle
code for java pattern
code for java pattern   * * * * * * * * please write the program of above pattern and do not use string tokennizer string buffer i mean to say that please use very simple method Thanks
 

 

 

DMCA.com