aspose file tools
The moose likes Beginning Java and the fly likes Remove Punctuations with regex Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Remove Punctuations with regex" Watch "Remove Punctuations with regex" New topic
Author

Remove Punctuations with regex

rakesh sugirtharaj
Ranch Hand

Joined: Dec 16, 2007
Posts: 151
IS there a way to remove punctuations in a String with Regex and Pattern matching?


Cheers!
RSR
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32708
    
    4
Try the replaceAll method with punctuation passed as the first argument.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4167
    
    3

Read the API for java.util.regex.Pattern. There's a POSIX character class that matches punctuation.

Here's a great resource for better understanding of regex:
Learn How to Use and Get The Most out of Regular Expressions


luck, db
There are no new questions, but there may be new answers.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32708
    
    4
I like the regular expression trail in the Java� Tutorials.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Remove Punctuations with regex
 
Similar Threads
Regex
Reg Expressions
Regular expression help
treating variable as regex
Regular Expression