aspose file tools*
The moose likes Java in General and the fly likes Help with regular expressions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Help with regular expressions" Watch "Help with regular expressions" New topic
Author

Help with regular expressions

Janhavi Namshikar
Ranch Hand

Joined: Sep 29, 2005
Posts: 85

Hi,
I need some help with regular expressions. I know the package java.util.regex having Pattern, Match classes, but am not sure how to use it.

What I am trying to do is this : I have to check and remove special chars like "< & ^" from a string. I have to use regular expression (regex package) for that.

Please help me out with this one.

Thanks,
Janhavi.


"Weekends don't count unless you spend them doing something completely pointless."
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Why do you have to use the regex package?
Is this a homework assignment or something?

It's certainly possible to use the regex
package, but there are other ways. If the
regex package seems spooky to you, you can
do it with just the methods provided by the
String class.


bitguru blog
Janhavi Namshikar
Ranch Hand

Joined: Sep 29, 2005
Posts: 85

It's an assignment for me. Othwerwise I could have easily gone for the String methods.
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
hi,

are you on java 5? check the javadoc of the Pattern class, it's really well-documented and straightforward...

greetings,
jan
Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
This site will probably be more helpful than the javadocs:

http://www.regular-expressions.info/tutorial.html
Janhavi Namshikar
Ranch Hand

Joined: Sep 29, 2005
Posts: 85

Thanks Jan and Alan.
Kevin Davies
Greenhorn

Joined: Jun 20, 2005
Posts: 14
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with regular expressions