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

Feature request: replace all with register group bind macro #22

Open
mmontone opened this issue Apr 8, 2015 · 2 comments
Open

Feature request: replace all with register group bind macro #22

mmontone opened this issue Apr 8, 2015 · 2 comments

Comments

@mmontone
Copy link

mmontone commented Apr 8, 2015

I would like to have a register-group-bind like macro for replacing all the regex occurrences in a string.

It would be something like:

replace-register-groups var-list (regex target-string &key start end sharedp) declaration* statement* => result*

where result* is the replacement of regex matching in target-string with the result of statement*

Does this make sense? I looked for something like this for one of my tasks, but I couldn't find it, apart from regex-replace-all

@mmontone
Copy link
Author

mmontone commented Apr 8, 2015

Example:

(regex-replace-all "@emph{(.*?)}" "@emph{this} is @emph{emphasized}"
                   (lambda (match text) 
                 (format nil "\\emph{~A}" text))
                   :simple-calls t)

Would be equivalent to:

(register-groups-replace (text) ("@emph{(.*?)}" "@emph{this} is @emph{emphasized}")
    (format nil "\\emph{~A}" text))

@mmontone
Copy link
Author

mmontone commented Apr 8, 2015

Ok, I could write that macro, but well...just an idea, may make sense to be part of the api, I don't know.

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

1 participant