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

Add a replace method to an expression #66

Closed
pombredanne opened this issue Apr 6, 2017 · 2 comments
Closed

Add a replace method to an expression #66

pombredanne opened this issue Apr 6, 2017 · 2 comments
Assignees

Comments

@pombredanne
Copy link
Collaborator

This should have the same semantics as the stdlib string.replace():

string.replace(s, old, new[, maxreplace])

    Return a copy of string s with all occurrences of substring old replaced by new. 
    If the optional argument maxreplace is given, the first maxreplace occurrences are replaced.

This is more or less what subs() does but subs is too complex for my case and I do not need recursivity.

I need a simpler lower level way to do only one replacement at a time and not many. There are a few wrinkles in the subs code too where iterating on items() could be replaced by a cleaner and more efficient get() that could be cleaned up too.

@pombredanne pombredanne self-assigned this Apr 6, 2017
@pombredanne
Copy link
Collaborator Author

@Kronuz ping. I recalled this was an area of some interest to you

pombredanne added a commit that referenced this issue Jun 9, 2017
 * the subs methods does exactly what is needed in #66. This just adds
   some comments and update the name of a few variables to better
   explain the substition processing.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@pombredanne
Copy link
Collaborator Author

This is supported out of the box with subs(). I am closing.

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

No branches or pull requests

1 participant