[racket] regexp-match* that returns clusters?
I wrote the following function
(define/contract (regexp-match-all re str)
(regexp? string? . -> . (listof (listof (or/c string? #f))))
(map (λ (s) (regexp-match re s))
(regexp-match* re str)))
I don't know if it would be worth including among the standard regexp operators.
Todd
On Sat, Dec 18, 2010 at 10:03 PM, Todd O'Bryan <toddobryan at gmail.com> wrote:
> Is there some equivalent of regexp-match* that returns a list of all
> the (non-overlapping) matches in a string.
>
> I want something like:
>
>> (regexp-match*-clusters #px"(?:^|\\s+)([A-Z])" "This gets Initial CAPS, I hope")
> '(("T" "T") (" I" "I") (" C" "C") (" I" "I"))
>
> Any luck?
>
> Thanks!
> Todd
>