Menu

#10 RKL: Need API to that returns ranges, instead of strings

open
API (7)
5
2009-12-28
2009-12-28
James Berry
No

It would be great to have an API similar to captureComponentsMatchedByRegex:range:, but which returns the results as NSRanges rather than strings.

I find myself in the situation of having to call rangeOfRegex:inRange:, in order to determine where the match occurred, followed by captureComponentsMatchedByRegex:range: to determine the captures from that match.

I am iteratively traversing a string looking for matches, processing the captures, and then looking for the next match. I have to track the position of the match because I also have to process the text before and after the match.

Discussion

  • James Berry

    James Berry - 2009-12-28

    I guess this is a similar request to 2875906. And it could be implemented nicely by making this an option flag (as also suggested in 287590) that would return arrays of NSValues representing NSRange, instead of NSStrings, so that your API set wouldn't balloon out too much.

     
  • James Berry

    James Berry - 2009-12-28
    • summary: Need API to that returns ranges, instead of strings --> RKL: Need API to that returns ranges, instead of strings
     
  • James Berry

    James Berry - 2009-12-28

    Hmm. This sourceforge project setup confuses me. This is a feature request for RegexKitLite, if that's not clear.

     

Log in to post a comment.