I have a string input to my program of the form:
con*.cc
I want this to represent the regular expression, con.*.cc.
How can I do this inside a C program? Is there something like sed that I can use?
I have a string input to my program of the form:
con*.cc
I want this to represent the regular expression, con.*.cc.
How can I do this inside a C program? Is there something like sed that I can use?
What exactly would you like to do with that regex? Assuming, that you will want to do a search on a set of strings that you already have in your code, you will need to use a regex library. C does not support regular expressions natively. Look up the gcc manual -- here.
Use sed from within your program:
This page describes the <regex.h> header, which implements POSIX regular expression support for C. To use this, you just do:
#include <sys/types.h>
#include <regex.h>
They're fairly nice and easy to work with, but as @Chickencha said in a different answer, it looks as if you're after just globbing filenames, not doing true regular expression matching. Just thought I'd point out that C does indeed have support for regular expressions, since nobody had.