News for hackers. Stuff that matters.
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 :)
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

Re:Fun with regular expressions: part I by Zababa on Friday August 20, 2021 @02:06PM (#28249360)
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].

[1]: https://en.wikipedia.org/wiki/Spaced_repetition

[2]: https://apps.ankiweb.net/

Re:Fun with regular expressions: part I by teddyh on Friday August 20, 2021 @09:30AM (#28245689)
The GNU Emacs manual includes a printable reference card, available separately here: https://www.gnu.org/software/emacs/refcards/
Re:Fun with regular expressions: part I by asicsp on Friday August 20, 2021 @08:04AM (#28245104)
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.
Re:Fun with regular expressions: part I by yissp on Friday August 20, 2021 @09:03AM (#28245484)
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.
Re:Fun with regular expressions: part I by Joker_vD on Friday August 20, 2021 @10:13AM (#28246216)
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.
Re:Fun with regular expressions: part I by iddan on Friday August 20, 2021 @08:27AM (#28245245)
What helped me the most is reading and understanding the explanations on https://regexr.com/
Re:Fun with regular expressions: part I by veltas on Friday August 20, 2021 @08:18AM (#28245190)
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:Fun with regular expressions: part I by mdp2021 on Friday August 20, 2021 @09:45AM (#28245858)
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
Re:Fun with regular expressions: part I by fifticon on Friday August 20, 2021 @08:44AM (#28245351)
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.