[racket] regexp-match* that returns clusters?
Yesterday, Todd O'Bryan 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"))
BTW, an easier way to get the initial caps:
(regexp-match* #px"\\b[A-Z]" "This gets Initial CAPS, I hope")
Three hours ago, Todd O'Bryan wrote:
>
> I don't know if it would be worth including among the standard
> regexp operators.
Doing this in the generalized macro that makes all of these functions
will be difficult (since it creates functions that are applicable in
many cases: input ports, strings, and byte strings). There were a few
occasions that I was close to wanting such a function, but somehow
each time the need went away by itself... perhaps because these cases
are even closer to parsing so reorganizing the way that parsing is
done turned out to be better. (In other words, I never had a case
where I had to hack around the lack of this function.)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!