1.

Solve : Regex pattern for grep?

Answer»

I'm trying to write a regular expression that matches "one or more non-tab characters anywhere before the FIRST visible(0x21-0x7E) character in a given line."

I'm using GNU GREP. I'd like to stay POSIX compliant if at all possible.

Any help is appreciated.I came up with this:

Code: [Select]'^ *[^ [:graph:]]\{1,\}.*[[:graph:]]'
There are two literal tab characters in the above.

It seems to WORK. If anyone COULD provide any verification/optimizations, that would be great.

Edit:
Further optimized.
Code: [Select]'^ *[^ [:graph:]].*[[:graph:]]'



Discussion

No Comment Found