Regex in C on Linux: Very strange character

Regex in C on Linux: Very strange character

Post by danieljn » Tue, 26 Aug 2003 12:54:24


Hi,

I'm trying to come up with a regex that will match the following
character, enclosed in square brackets: [
]

-it's not a newline character (at least it's not the standard one)
because I tried to match it with \s as well as [[:space:]] and
[[:blank:]], none of which resulted in a match.

-the only way I can match with it is to use \W, but this is too loose.

-the other way is of course to copy-and-paste, but I would prefer not
to do this.

-[[:cntrl:]] didn't match either

Please help,

Dan.
 
 
 

Regex in C on Linux: Very strange character

Post by Valentin N » Tue, 26 Aug 2003 15:53:29


D> I'm trying to come up with a regex that will match the following
D> character, enclosed in square brackets: [
D> ]

D> -it's not a newline character (at least it's not the standard one)
D> because I tried to match it with \s as well as [[:space:]] and
D> [[:blank:]], none of which resulted in a match.

D> -the only way I can match with it is to use \W, but this is too loose.

D> -the other way is of course to copy-and-paste, but I would prefer not
D> to do this.

D> -[[:cntrl:]] didn't match either

If you use regexps in C, you can embed any character as C character
constant using C syntax for it: '\001' for symbol with code 1, etc.
In regexp, it will be matched directly unless has special meaning in
regexp syntax.


-netch-