tballison commented on PR #558: URL: https://github.com/apache/tika/pull/558#issuecomment-1127896442
> > @nddipiazza @tballison This looks messy, can you advise a way to clean it up? A better way of doing it? Still think its worth having the comments there? > > OMG, what a mess. The output, not you. > > What I've done before is a regex pattern+matcher that captures the escape sequence first OR then the controls ~/(\\)|(\[A-Z0-9]{1,5})/, capture group(2) (and skip it), append group 1 to tail. > > That's a rough answer and probably wrong, but see what you can do. > > The braces...hmmmm... Maybe take a second pass and do the same thing? You can't just add this in the OR ~/{[^}]{0,50}}/ because that'll not correctly process escaped } within the brackets. I threw together a somewhat working example. I think there are still some things I'm missing: https://github.com/tballison/tika-addons/blob/main/DWGReadDev/src/test/java/TestRegexCleaners.java Obv, we'll want to make the patterns static, etc. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tika.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org