I have written a c program that retrieves arguments from the command line under Windows. One of the arguments is a regular expression. So I need to retrieve special characters such as "( , .", etc., but cmd.exe treats "(" as a special character.
How could I input these special character?
thanks.
You can generally prefix any character with
^
to turn off its special nature. For example:That's a caret followed by an ENTER after the word
do
.You can put the arguments in quotes:
Though I wouldn't assume that parentheses cause problems unless you are using blocks for conditional statements or loops in a batch file. The usual array of characters that are treated specially by the shell and need quoting or escaping are:
If you use those in your regular expression, then you need quotes, or escape those characters:
(
^
is the escape character which causes the following character to be not interpreted by the shell but instead used literally)