MLUG: [MLUG] String manipulation in C
[MLUG] String manipulation in C
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I have a little problem that you guys might be able to solve. I am trying to find out where a short sequence of letters matches in a much longer sequence of letters. I can find the location of the first match, but I cannot make it find any subsequent matches and need to. After reading the GNU regex documentation, I don't think that the regexec() function searches beyond one match of pattern in string.

So what I'd like to do is hack everything off of the first string after the end of the first match. If I am looking for "ABC" in the following string:

     XXXXXABCXXXXXABCXX

I'd like to reduce the string to

    XXXXXABCXX

after the first "ABC" is found so that the second match can be found. I cannot find a function that will copy the last n digits of a string into an array (sort of an opposite to strncpy()) so that I could simply cleave out anything before and including the match in string, then search the remainder.

Any help would be appreciated.

Jack
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members