Date: Thu, 24 Oct 2002 07:20:25 -0700 Mime-Version: 1.0 (Apple Message framework v546) Content-Type: multipart/alternative; boundary=Apple-Mail-4--820032763 Subject: POSIX REGEX From: Daniel Staudigel To: djgpp AT delorie DOT com Message-Id: X-Mailer: Apple Mail (2.546) Reply-To: djgpp AT delorie DOT com --Apple-Mail-4--820032763 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed The tutorial on your site is great, but I think some sample code would be in order. I think that my code *should* work, but when I printf, it comes up blank, sorry to sound like a n00b, but in C regex, I sure as heck am. #include #include #include int main (int argc, const char * argv[]) { regex_t regex; regmatch_t matches[4]; char string[] = "uhohthismaynotwork"; regcomp(®ex,"uhoh\([[:alnum:]]\)",0); regexec(®ex,string,4,matches,0); printf("%s - %s\n",string,string+matches[0].rm_so); return 0; } and I get: CREGEX has exited due to signal 11 (SIGSEGV). during the printf statement. rm_so is obviously out of bounds, but I don't have a clue why that would be. Thanks a lot. Daniel Staudigel --Apple-Mail-4--820032763 Content-Transfer-Encoding: 7bit Content-Type: text/enriched; charset=US-ASCII The tutorial on your site is great, but I think some sample code would be in order. I think that my code *should* work, but when I printf, it comes up blank, sorry to sound like a n00b, but in C regex, I sure as heck am. #include < #include < #include < int main (int argc, const char * argv[]) { regex_t regex; regmatch_t matches[4]; char string[] = "uhohthismaynotwork"; regcomp(®ex,"uhoh\([[:alnum:]]\)",0); regexec(®ex,string,4,matches,0); printf("%s - %s\n",string,string+matches[0].rm_so); return 0; } and I get: CREGEX has exited due to signal 11 (SIGSEGV). during the printf statement. rm_so is obviously out of bounds, but I don't have a clue why that would be. Thanks a lot. Daniel Staudigel --Apple-Mail-4--820032763--