Closed japanoise closed 2 years ago
Increasingly wondering if PCRE is the right choice here. If I have a way of collecting matches, I have M-/
basically for free. Thinking about it and evaluating my options.
I could gate out PCRE, so that those that don't need that functionality can just #define and go home. Other regexp libraries might work for basic regex search and replace. I would just dearly like those capture groups for M-/
.
https://github.com/kokke/tiny-regex-c seems like the best choice, actually. However, in the great emsys tradition, M-/
will be a lot simpler than it is in gomacs.
search = last-alphanumeric-word
if strlen(search) <= 0
return
matches = vector-of-matches
for buffer in buffers
for line in buffer.lines
if regex_match(line)
append match to matches
chosen = tab_complete_on_matches()
insert chosen into row
Regexp replace should be simple enough along similar lines: find a match, replace it with the replace string, bob's yer uncle.
First part just done: a639ee90875cf8ab9c194d9dfc8ad2079798c5be
The little regex library that could! It's a great success. All we need now is a regex-replace to go with string-replace, and we'll be laughing.
Regices?
There's single-header regex libraries out there. It would probably be the last single-header added because it's the last big feature.