-
Notifications
You must be signed in to change notification settings - Fork 70
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
--replace which regex can be used and how replace with empty string #173
Comments
It all happens in thie class: https://github.com/sylvainhalle/textidote/blob/master/Source/Core/src/ca/uqac/lif/textidote/cleaning/ReplacementCleaner.java The replacement itself occurs in
I wrote this quite some time ago, but as I see in the code, you can use groups (parentheses) in the find pattern and group references (e.g. $1, etc.) in the replacement pattern --although be warned that there does not seem to be any unit test covering this feature! As to the way to replace a string by nothing (empty string), indeed I don't think it can be done at the moment. Will think of a way of allowing this... |
This is some kind of a follow up from #171 but the question is somewhat more general.
How would one replace a string by an empty string via a replacement file?
Currently, I'm using
\\figref\{.*\}
but this replaces with a space (which throws some warnings about spaces before punctuation etc.). Just\\figref\{.*\}
(no space at the end) didn't work for me as well.Maybe you could elaborate too on, how the regexes are evaluated.
Is it possible to use perl regex to specify whether
*
should be greedy or not?Does
Both search and replace can be regular expressions.
mean that one can use backreferences in the regexes? If not what does this mean? That one can use a regex as replacement? (As far as I checked,.*
is considered as string not as regex in the replacement 'column')The text was updated successfully, but these errors were encountered: