Tuesday, 22 March 2016

Some of the predefined POSIX in regular expression

The usage position of metacharacters in a regular expression determines the result of the regular expression. If caret (^) metacharacter is used inside a character list, it means the negation of a character list. Therefore, [^[:digit:]] looks for a pattern consisting of any non-digit character. Therefore, in the given scenario, you will use the [^[:digit:]] regular expression to accomplish the task.

Some of the predefined POSIX (Portable Operating System Interface) character classes are as follows:
  • [:alpha:] Alphabetic characters
  • [:lower:] Lower case alphabetic characters
  • [:upper:] Upper case alphabetic characters
  • [:digit:] Numeric digits
  • [:alnum:] Alphanumeric characters
  • [:space:] Non-printing space characters
  • [:punct:] Punctuation characters
  • [:print:] Printable characters
Answer options A and D are incorrect. The caret (^) metacharacter cannot be used at the end of any regular expression.

Pattern = [^[:digit:]]

No comments:

Post a Comment