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?

I'm sure I would have to download some sort of scripting language but like

That's fine

Look how annoying this shit is tho

Why would you hardcode page numbers in an ebook

This is the type of shit we SHOULD be working on when it comes to various forms of computer automation and natural language processing tbh

Calibre does have a regex parser in its HTML search but I do NOT understand regex at all

@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 :clodsire_head:​:clodsire_tail:​

@wallhackio @coriander you doofus, HTML requires a Type-2 Chomsky grammar and a regex is only Type-3

@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

Follow

@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)

@Lady @wallhackio @coriander you can purrove things like this (more purrecisely stated, “this” being that a*ba* is not a regular language) is true, you would use the pumping lemma

@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

@aescling @Lady @wallhackio @coriander I was going to say, you literally just expressed it as a POSIX regex. 😛

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.