RegEx for Speedy Story Revision
Here are the current iteration of these two RegEx search strings. I will update this post to keep it up to date. The \b requires a beginning- or end-of-word to maximize exact matches. The (?: ) is a non-replacing grouping for multiple words with similar issues, and for he/she matches. Depending on your writing, you may want to change the pronouns to he|she|it|they. Both RegEx rely on NOT selecting Case Sensitive for searches.
can\b|can't|can not|could\b|couldn't|cannot|shall\b|shan'|shall not|shoud\b|shouldn't|should not|would not|\bwould\b|\bwouldn't|\bwith\b|without|write\b|\bright|lead\b|\bled\b|lede|choose|chose|lose|loose
ly\b|\babout\b|almost|already|barely|\bbit\b|begin|\bbegan\b|\can|certain|generally|\bguess|\bjust\b|kind|\blike|maybe|mostly|near|course|pretty|perhaps|possibly|potentially|really|probably|\bseem|\bsome\b|sort|start|\bstill\b|surprisingly|suppose|\bthink\b|usually|could|\bsaw\b|\bheard\b|\bfelt\b|\bknew\b|\bread\b|noticed|recognized|\band\b|\bbut\b|(?:I|he|she) could (?:see|hear|taste|touch)|(?:I|he|she) (?:saw|hear|knew|read|felt|noticed|recognized) that|you can|made certain
If you use #Scrivener, this is the procedure for turning these searches into Binder/Left-sidebar buttons on the Mac, though probably similar on Windows:
If you need to update a collection, use this procedure:
On the iPad and iPhone, RegEx search exists but only finds a single word or phrase at a time. Disappointing, but it works. You will find RegEx which you tap gear icon when using Find. You can't save the search, but I put it in the Notes app so I can reference it easily.
The image shows Weasel and Hedge Words in use. In the top left, you'll see the search box with the RegEx, and below it my two collections which are titled Positives and Negatives and
Weasel and Hedge Words. Note the highlights. Desktop Scrivener shows all matches, making quick review and revision a snap. I've added "and" and "but" and "ly" to highlight overuse of conjunctions and adverbs. There's also double-word error highlighted.
May your editing, revising, and review be simple and swift!
Got a 15LoC implementation of #regex-ish matching in #Modal. Or, rather, something in between match patterns (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns) and #Scheme Regular Expressions (https://srfi.schemers.org/srfi-115/)
Matches (explode f.o*b+r) with (expode fooasdfasdbar) and not (explode foxbr)
Resides in ed.modal for now (because I'm entertaining myself with the idea of using it for s-ubstitution command:) https://github.com/aartaka/ed.modal/blob/master/match.modal
#regex - это воплощение поговорки “смотрю в книгу - вижу фигу”
@PragmaticAndy Ive felt the same myself - pedantry for writing comms helped my coding skills alot.
However, while Python is useful in order to have an experiment it provides a ceiling.
Would this be the case for using #regex for instance?
Or multi dimensional arrays in Gawk?
How to make your regular expressions more readable in PHP: https://andycarter.dev/blog/readable-regex-in-php
My recent obsession with the #OscarMamen travel logs of his journey(s) to & time in #Mongolia #BogdKhanate, I wrangled data from a photo archive database.
For unknown reasons, the database doesn't have a field for "date". All date info is stored alongside content descriptions of the photos and their location in the physical archive in the free-text field "motive description".
To work through 7.500 photos + matching them to log entries, I re-taught myself #regex & @OpenRefine
Can recommend!
if you're a cross platform user like me this is especially useful for normalizing and sanitizing files and directories! and `mv` or `rename` mishaps are prevented with #brename!
behold: your new favorite cli too for batch renaming of files and directories via #regex and do it fast *and* safe. i'm very confident.
https://github.com/shenwei356/brename
also available in #macOS and #linux #homebrew as `brename`
(macOS users that like a GUI: i also use Name Mangler and it lets you 'playground' various methods easily too.)
https://github.com/shenwei356/brename
our director of tech at work sent me this and made my day
I still can't believe that most programming systems we use today are preoccupied with numbers. AFAIK, half of (R5RS?) #Scheme standard is numbers and operations on them. Same for #C, #CommonLisp, #Java—ten different types of numbers and huge libraries for them.
Humans think in images and words. Structured text-oriented languages feel like a much better fit for everyone not corrupted by C. Yet we have little to no popular attempts in that space. Structured Regular Expressions didn't catch up; #ed1 and #awk are considered mere #regex automation tools. Modal and the term rewriting systems have their Merveilles Town, but not much beyond. sh/#bash and the like are quite successful, but aren't considered real programming languages either.
Why.
Ah yes, the age-old tale of Regex: the #mystical, misunderstood #ogre of the #coding world . The article bravely ignores 90% of its complexity, claiming if you squint just right, it's actually a friendly #garden #gnome
. Just remember, if your regular code takes days and your #regex takes minutes, maybe it's time to
refine those coding #skills.
https://timkellogg.me/blog/2023/07/11/regex #Developer #Humor #HackerNews #ngated
Whoever uses #regex should know about this invaluable tool:
I consider myself a regex expert, and still every now and then I have cases which I can't figure out myself. This tool has never let me down so far... You can of course configure it to operate according to most of the important #regexp "flavors"...
Do I have #regex experts among my followers: echo "123.4506000" | sed -E 's/(\.[0-9]*[1-9])?0+$//; s/\.$//' is intended to remove trailing 0s when its a number with a decimal point. But when there are no cifers behind the decimal point other than 0s, the whole number shall be stripped of the point and the 0s. What are I am doing wrong? Sharing appreciated.
Behold the epic tale of Janet's #PEG #module, where the author heroically excludes regular expressions like they're yesterday's news.
Marvel at the labyrinth of #parsing magic that claims to be more readable, but only if you have a PhD in arcane text processing.
https://bakpakin.com/writing/how-janets-peg-works.html #Janet #readability #textprocessing #regex #HackerNews #ngated
You know how you can understand something like Regular Expressions (Grep) well enough to write really complex statements that precisely match the nuanced text patterns you’re hoping to revise, but then 6 months later you look at this RegEx you wrote and can’t parse it at all? Like, literally no idea how it works? As in it-would-be-faster-to-recreate-it-from-scratch-than-to-understand-it-enough-to-change-it-even-slightly?
I feel like that all the time.
[FR]
Arrivée ici début 2025, big up aux @admin de Piaille.fr ! #introduction :
Tombée dans la marmite #OpenSource en 2000, je me nourris de commandes #bash. Fichiers texte, #grep et ses jolies #regex, #ansible, #git, #greasemonkey, les tests auto et la supervision sont tes amis.
Cordes frottées, grattées et frappées, sons soufflés, chantés ou beatboxés, sons électro ou scratchés me touchent. Rien de tel qu'une bonne soirée à jammer / à enregistrer pour un beatmaker / à débarquer sur scène pour accompagner quand il manque un instrumentiste / à repiquer des morceaux entiers sur papier à l'ancienne / à improviser avec les enfants
Engagée #AMAP et pro #CNV