• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

named character classes in grep

 
Minal Silimkar-Urankar
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know how to use named charactes classes with grep command?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17990
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Minal Silimkar-Urankar
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I use the named character constants with grep command?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic