hi . can someone plz explain how to do regex in C.
input: a text file.
aim: read each line from the text & check if a RegEx pattern exists. finally return that pattern if it exists.

plz share any algo or code snippets if u have.thx.

1. Start from http://en.wikipedia.org/wiki/Regular_expression
2. Select, download and install one of C regex libraries.
3. Get the library manual, read it carefully and see examples in the distributive...

hi ArkM. am using PCRE C API.
but am getting error when i pass a pattern as a parameter. can u help?
pattern is "/\d\d/"
error : unknown escape sequence '\d'

thx

If you want to place \d in C string literal, write \\ twise. Didn't you know that backslash is a special escape character in C?

aim: read each line from the text & check if a RegEx pattern exists. finally return that pattern if it exists.

There is exactly this example, just reading from stdin instead of custom file, at http://mij.oltrelinux.com/devel/unixprg/#regex . There's also a quick reference on the RegEx syntax on there.