Menu

Accessing all capture subpatterns

2009-01-24
2013-04-24
  • Sam Krishna

    Sam Krishna - 2009-01-24

    I've got a situation where I need to enumerate through all subexpression patterns, and I keep hitting brick walls on this one. I'd like to enumerate through all the capture subpatterns in a given RKRegex class (i.e. a method that would be probably be named -capturesArray). I've been trying to dig through the code for several hours to piece together how to write such a method, but I can't seem to make heads or tails of it.

    Any pointers as to what class/instance methods I could use, or the C function to make this happen? I've tried digging through the different C functions that form the guts of RegexKit.framework, but because my low-level knowledge of C isn't so hot, I really have no idea where to start here.

    TIA!

     
    • Sam Krishna

      Sam Krishna - 2009-01-24

      Never mind. I found the answer here:

      http://www.cocoadev.com/index.pl?RegexKit

      Truly a very smart developer, that John man is.

      -S

       
    • Sam Krishna

      Sam Krishna - 2009-01-24

      Alright... I spoke too soon. My original request stands:

      I need a way to iterate through all the *capture subpatterns* in the regex, not the *captured subpatterns*. (potential, not actual). If anyone has any code ideas for this, it would be really great.

      -S

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.