Re:Fun with regular expressions: part I
by holoduke on Friday August 20, 2021 @07:53AM
(#28245019)
Am I the only one who keeps forgetting even most basic expressions. I am using them for a long time, but somehow not enough to remember them. Always find what I need in a few minutes by using Google, but still. Not proud of it :)
[ Parent
| on HN ]
Re:Fun with regular expressions: part I
by bloopernova on Friday August 20, 2021 @08:13AM
(#28245155)
I have this issue with certain Emacs commands. I don't know if this will work for you, but here is what I've done to mitigate that loss:
I use a permanent marker on a 3x5 index card, and write the command and key combo in black, and then a very "simple" explanation in blue. For instance, "SWIPER SEARCH" "C-c C-s" "inside files". or "DEFT SEARCH" "C-c n d" "across files".
Those index cards get pinned on my home office wall above my main monitor screen. Seems to help a bit for me, not sure if it would for other folks.
Here's a pic for the visually inclined! https://imgur.com/gallery/zlY5wYH
In case you never heard about it (and for other people), these cards seem like the perfect thing to put in a spaced repetition [1] program like Anki [2].
The GNU Emacs manual includes a printable reference card, available separately here: https://www.gnu.org/software/emacs/refcards/
Try maintaining your own cheatsheet. Every time you need to look up something, make a note along with examples and documentation links. This should help at least for the basic usage.
The thing that gets me is remembering the slightly different rules for the various regex engines. Like which ones support which operators, which operators need to be escaped, etc.
No, you're not the only one. That's actually the main reason why I personally stopped using them entirely several years ago and just write straightforward loops that search for things I need in the input string.
What helped me the most is reading and understanding the explanations on https://regexr.com/
Just trying thinking about one thing you forget a bit longer each time you encounter it, and trying to rationalise why the syntax is as it is. Slowly build it up. You don't need to remember the whole thing at once.
Re-thinking them in real time is good for you, and a much better exercise than memorizing them.
To remember notions, a necessary but less noble capacity, we have invented tools well past the Memex. To be "smart", not yet.
Re:Fun with regular expressions: part I
by ALotOfBees on Friday August 20, 2021 @09:55AM
(#28245991)
remembering they exist is all you need. the actual syntax is just a quick google away. but yes, I can never remember almost any expressions either
On this off-topic, learning shortcuts for menus:
I wish applications allowed you to enable 'show-me' menus.
It would be a browsable GUI menu as you know them, but it would not RUN any commands! Only let you see the keyboard shortcut. So you would always have to _type_ the shortcut you had looked up. I naively assume this would accelerate remembering the shortcut keys.