aspose file tools*
The moose likes Linux / UNIX and the fly likes named character classes in grep Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "named character classes in grep" Watch "named character classes in grep" New topic
Author

named character classes in grep

minal silimkar
Ranch Hand

Joined: Nov 25, 2007
Posts: 133
I want to know how to use named charactes classes with grep command?


Minal Silimkar
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15628
    
  15

Character-class pattern for USA format date string (MM/DD/YYYY):

[:digit:][:digit:]/[:digit][:digit:]/[:digit:]{4}

Which is equivalent to

\d\d/\d\d/\d{4}

Or \d{2}/\d{2}\/d{4}

Except that character classes may be more locale-sensitive, if I understood them correctly.

Another benefit of the named classes is that backslashes can bite.
[ April 18, 2008: Message edited by: Tim Holloway ]

Customer surveys are for companies who didn't pay proper attention to begin with.
minal silimkar
Ranch Hand

Joined: Nov 25, 2007
Posts: 133
How can I use the named character constants with grep command?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: named character classes in grep
 
Similar Threads
struts2: Generating list of localisation keys?
Command to add lines to multiple files
File find utility?
Search tool to search all class files
Maintaining File Size while writing