196
Community Rules
You must post before you leave
Be nice. Assume others have good intent (within reason).
Block or ignore posts, comments, and users that irritate you in some way rather than engaging. Report if they are actually breaking community rules.
Use content warnings and/or mark as NSFW when appropriate. Most posts with content warnings likely need to be marked NSFW.
Most 196 posts are memes, shitposts, cute images, or even just recent things that happened, etc. There is no real theme, but try to avoid posts that are very inflammatory, offensive, very low quality, or very "off topic".
Bigotry is not allowed, this includes (but is not limited to): Homophobia, Transphobia, Racism, Sexism, Abelism, Classism, or discrimination based on things like Ethnicity, Nationality, Language, or Religion.
Avoid shilling for corporations, posting advertisements, or promoting exploitation of workers.
Proselytization, support, or defense of authoritarianism is not welcome. This includes but is not limited to: imperialism, nationalism, genocide denial, ethnic or racial supremacy, fascism, Nazism, Marxism-Leninism, Maoism, etc.
Avoid AI generated content.
Avoid misinformation.
Avoid incomprehensible posts.
No threats or personal attacks.
No spam.
Moderator Guidelines
Moderator Guidelines
- Don’t be mean to users. Be gentle or neutral.
- Most moderator actions which have a modlog message should include your username.
- When in doubt about whether or not a user is problematic, send them a DM.
- Don’t waste time debating/arguing with problematic users.
- Assume the best, but don’t tolerate sealioning/just asking questions/concern trolling.
- Ask another mod to take over cases you struggle with, if you get tired, or when things get personal.
- Ask the other mods for advice when things get complicated.
- Share everything you do in the mod matrix, both so several mods aren't unknowingly handling the same issues, but also so you can receive feedback on what you intend to do.
- Don't rush mod actions. If a case doesn't need to be handled right away, consider taking a short break before getting to it. This is to say, cool down and make room for feedback.
- Don’t perform too much moderation in the comments, except if you want a verdict to be public or to ask people to dial a convo down/stop. Single comment warnings are okay.
- Send users concise DMs about verdicts about them, such as bans etc, except in cases where it is clear we don’t want them at all, such as obvious transphobes. No need to notify someone they haven’t been banned of course.
- Explain to a user why their behavior is problematic and how it is distressing others rather than engage with whatever they are saying. Ask them to avoid this in the future and send them packing if they do not comply.
- First warn users, then temp ban them, then finally perma ban them when they break the rules or act inappropriately. Skip steps if necessary.
- Use neutral statements like “this statement can be considered transphobic” rather than “you are being transphobic”.
- No large decisions or actions without community input (polls or meta posts f.ex.).
- Large internal decisions (such as ousting a mod) might require a vote, needing more than 50% of the votes to pass. Also consider asking the community for feedback.
- Remember you are a voluntary moderator. You don’t get paid. Take a break when you need one. Perhaps ask another moderator to step in if necessary.
view the rest of the comments
Curly braces are number of characters. Round braces are capture groups - their content can be used in search and replace. So abbba and regex a(b{3})a. Capture group 1 would be bbb.
"\" is usually some specific character. "\d" is any digit. "\s" is any whitespace character.
The thing on the board I don't think is pure regex but a search and replace command and I think its wrong. It matches "272-43-17382" or similar digits. The 1 and 2 are usually capture groups in awk but on the board there is a "$" behind it which usually means end of string which doesn't make sense. Should be I think:
"s/^(\d{3})-(\d{2})-(\d{5})$/\2 \1/g"
"Globally replace a string formatted like 273-34-27472 with 34 273"
!onehundredninetysix@lemmy.blahaj.zone
There's something else: the backslash followed by a positive natural number means a reference to the nth capture group, so:
"truthfultemporarily".match(/(t)(r)(u)\1hf\3(l)\1empo\2a\2i\4y/)...as esoteric as it may sound, will match your Lemmy username, because the
\1will correctly match the first capture group which ist,\2will match the second capture group which isr, and so on so forth... Oh, and it works beyond.replacecontexts, during.matchas well.Source: I just learned through this very meme and, from now on, I'll likely use this feature whenever I have to use RegExp because I love coding cryptic one-liners just for the sake of it.
Heheh
I love bringing out all the nerds to talk on random niche topics :3
Right!? I love what you've caused here. Especially since I was wondering the same thing myself. I'm really enjoying these neat, informative replies! I <3 NERDS!
from the
/gat the end i agree it looks like it could be a malformed attempt at an awk/perl/etc substitution operation, and your rewrite of it as ans///does work, but the parts between the^and$would also be a valid regexp in Perl-compatible regexp and some other dialects if not for the spaces at the start and end. And, the/gis also a flag ("Match globally, i.e., find all occurrences.") for them///matching operator in Perl.The
\1and\2are backreferences to the capture groups, which can be used not only in the replacement part but also in the pattern itself.You can see this working by running this command:
echo '123 - 45 - 67890 45 123'|perl -ne 'print if m/^(\d{3}) - (\d{2}) - (\d{5}) \2 \1$/g'...which will echo the string because it matches the pattern. (if you edit the input string to change, for instance, the last digit, it will no longer match and will output nothing.)
There is no input that can match the pattern as it is in the comic with the space before the
^and after the$however.Interestingly backreferences are also supported by POSIX Basic Regular Expressions (BRE), but are not supported by POSIX Extended Regular Expressions (ERE). (Also the former requires you to escape parenthesis and curly braces for them to become meta characters, while the latter requires you to escape them if they're literals as Perl etc do. And neither of the POSIX flavors supports
\das a shortcut for[0-9].)The /g at the end is the global operater. It means, roughly, match across the entire input string.
This is completely valid regex, not a malformed attempt at anything. It's just that the delimiters and operators are often omitted from regex in practical use so you may not be used to seeing them.
yeah, i edited my comment while you were replying to note that
/gis a valid flag form///as well. it is a valid perl matching operation precisely as-is but it can't match anything due to the spaces it has before the^and after the$.This definitely seems like a possible use case, but personally I think practical application of sed would be a bit advanced for a "Regex 101" course.
Yeah, I think I'm catching the general idea.