Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex on text streams #25

Closed
rust-highfive opened this issue Jan 25, 2015 · 4 comments
Closed

Regex on text streams #25

rust-highfive opened this issue Jan 25, 2015 · 4 comments

Comments

@rust-highfive
Copy link

Issue by suhr
Wednesday May 07, 2014 at 14:18 GMT

For earlier discussion, see rust-lang/rust#14015

This issue was labelled with: A-libs in the Rust repository


Regex library defines methods for find/replace on strings, but what about text streams?

@BurntSushi
Copy link
Member

Looking at the original issue, I did some research (rust-lang/rust#14015) on this a while back and I think I concluded that this was hard/impossible to do in the general case.

I would be very happy to hear about a more specific proposal in a new issue.

@gilescope
Copy link

(In my case I'm streaming stdout of a child process on a server back to a browser.)

Would it be possible to give a closure that acted on the match and returned the replacement rather than trying to return matches in the stream? That way you might be able to still deal with &str rather than having to allocate.

I do wonder if we're really asking for a pure rust SED clone.

@BurntSushi
Copy link
Member

@gilescope This issue is extremely old. Please see #425 for updated and very in depth discussion on this task. Closures or not-closures isn't really the issue.

@gilescope
Copy link

Thanks for pointing me in the right direction, yes I can see it's non-trivial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants