Click to See Complete Forum and Search --> : Pattern Matcher


Lakshmanan
August 11th, 1999, 08:02 AM
Hi,

I am just trying to find a pattern matching api . Can u tell me which
one can I use.

I have a
String str = "Good";
String test = "G*";

I want to know whether 'str' is of the pattern 'test' (in this case true).

Thanx in advance.

If a reply could also be copied to lakshmanan.r@in.bosch.com , I'd really
appreciate it.

With Regards,
Lachu
lakshmanan.r@in.bosch.com

August 11th, 1999, 09:47 AM
hai,
As far as i know, there is no pattern matching api as such. Instead of opting for a readymade api, u could make the best use of methods in String/StringBuffer classes.

Methods that would be very important to achieve your goal would be startsWith(), endsWith(), regionMatches() etc. Java's string handling capabilities are so good that U could accomplish your objective with very few lines of code. U could refer to documentation of Sun for the exact signatures of these methods.

thanx,
devi prasad
devi_prasad@mailcity.com

V Phaniraj
August 11th, 1999, 03:25 PM
There are several free regular expressions packages in Java that will do what you require - for example
http://www.oroinc.com/

Raj