271

you are viewing a single comment's thread
view the rest of the comments
[-] mindbleach@sh.itjust.works 12 points 1 year ago

It's pattern-matching. Like searching *.txt to get all text files. It's just... more. There's symbols for matching the start of a string, the end of a string, a set of characters, repetition, etc. Very "etc." And the syntax blows. The choices of . for match-any-character and * for zero-or-more really fuck with common expectations.

It can also replace substrings that match. Like changing the file extension of all text files. Where it gets properly difficult is in "capture groups." Like looking for all file extensions, and sticking a tilde after the dot. You can put parentheses around part of the pattern being matched and then reference that in the replacement. Conceptually simple - pain in the ass to use properly - syntax both sucks and blows.

Lookahead is what you do to match "ass" but not "assault." I refuse to elaborate further.

this post was submitted on 12 Nov 2023
271 points (95.3% liked)

Programmer Humor

32706 readers
349 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS