So I'm trying to go in and clean up some of my ebooks because I have some in my digital library that have various things that really annoy me, page headers and such with my name and email, page numbers stuck in the middle of paragraphs, things like that
I've got calibre downloaded and can get into the actual HTML of the ebooks and make edits but my GOD it's slow and tedious to do it manually
There HAS to be a way to automate this somehow, right? Some kind of script where I can say "Find every instance of this string and delete it" right?
@coriander this is why i recommended BeautifulSoup
@coriander you could use regex if you hate yourself or are @Lady
@wallhackio @coriander i like regex but i would never use it for HTML
@Lady @coriander I used it for HTML in the evil source code that powers my blog
@wallhackio @coriander you doofus, HTML requires a Type-2 Chomsky grammar and a regex is only Type-3
@Lady @coriander i have no idea what this means but go off
@wallhackio @coriander Chomsky is a guy that coriander hates that did some things in linguistics and also computers
@Lady @coriander I KNOW WHO CHOMSKY IS i just don't know what the hell type-2 and type-3 chonky grammers are
@wallhackio @coriander chomsky's grammar hierarchy is (3) regular (i.e. regular expressions), (2) context-free, (1) context-sensitive, (0) recursively enumerable
(3) and (2) are the only ones which actually matter because once you hit context-sensitive you have to grapple with the halting problem
the difference between them is regular grammars cannot ensure that every open parenthesis (quote, tag, etc) has a matching closing one, whereas a CFG can
@wallhackio @coriander (for clarity: a regular expression can ensure a closing parenthesis follows an opening parenthesis if you do not allow infinite nesting: /[(][^()]*[)]/
but if you allow infinite nesting of an opening paren after another opening paren, it cannot guarantee a closing paren for each)
@aescling @wallhackio @coriander æsc cares about this because she used to write lisp
@aescling @wallhackio @coriander lisp is the programming language for people who want every open parenthesis to be followed by a close parenthesis