It's not a secret anymore!*
The moose likes Beginning Java and the fly likes validating a syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "validating a syntax" Watch "validating a syntax" New topic
Author

validating a syntax

anoop kerala
Greenhorn

Joined: Mar 03, 2010
Posts: 10
hi,
i want to verify a string whether its given in the format,

a=b+c;

and prompt error if given,
1) a=;
2) a;
3) a=b+;

thank you..
lenin
Aditya Kanitkar
Ranch Hand

Joined: Aug 08, 2009
Posts: 72
a=b+c


You will have to form a Regular Expression which resembles to "c=a+b"

Any string that unmatches the given format/expression can be identified.
Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

Hi , You need to use Regular Exp.


Thanks,
Sherif
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What have you tried so far?
anoop kerala
Greenhorn

Joined: Mar 03, 2010
Posts: 10
tried but not postable..
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Here's the thing--we need you to DoYourOwnHomework. Without evidence of ShowSomeEffort, you're not likely to get much help.
anoop kerala
Greenhorn

Joined: Mar 03, 2010
Posts: 10
ok thanks.. i will try to come up with a postable code..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validating a syntax
 
Similar Threads
Question on class identification.
Quiz
need help(SCJP)
Context-param doubt
Triangulation algorithm