# Expression

Published articles for Expression.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## New things for regular expressions in PostgreSQL (pg\_tre and pg\_re2)

DevFeed: [New things for regular expressions in PostgreSQL (pg\_tre and pg\_re2)](<https://devfeed.tech/articles/new-things-for-regular-expressions-in-postgresql-pg-tre-and-pg-re2-33694.md>)

Original publisher: [Read original article](<https://www.depesz.com/2026/08/25/new-things-for-regular-expressions-in-postgresql-pg_tre-and-pg_re2/>)

Author: depesz

Published: 2026-08-25T18:41:53Z

Content type: tutorial

Language: en

Sources: [select \* from depesz;](<https://devfeed.tech/sources/select-from-depesz.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [test](<https://devfeed.tech/topics/test.md>)

Tags: [expression](<https://devfeed.tech/tags/expression.md>), [extension](<https://devfeed.tech/tags/extension.md>), [extensions](<https://devfeed.tech/tags/extensions.md>), [pg-re2](<https://devfeed.tech/tags/pg-re2.md>), [pg-tre](<https://devfeed.tech/tags/pg-tre.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [re2](<https://devfeed.tech/tags/re2.md>), [regexp](<https://devfeed.tech/tags/regexp.md>), [regular](<https://devfeed.tech/tags/regular.md>), [regular-expressions](<https://devfeed.tech/tags/regular-expressions.md>), [test-data](<https://devfeed.tech/tags/test-data.md>), [uncategorized](<https://devfeed.tech/tags/uncategorized.md>)

### AI overview

This article compares PostgreSQL regular-expression approaches using pg_tre and pg_re2 against built-in matching and pg_trgm. Tests on a large table of query plans find that pg_tre is slower than pg_trgm for exact substring searches but supports fuzzy matching, while pg_re2 performs faster than the tested built-in scan. The author notes that both extensions have limitations and rough edges.

### Source excerpt

Well, truth be told these are not all that new (couple of months), but I finally have gotten around to research it. So, let's see what's what. For starters I need some test data. Luckily, I have explain.depesz.com DB... Extracted all plans to side table, with this structure: =$ \d all_plans Table "public.all_plans" Column | ... Continue reading "New things for regular expressions in PostgreSQL (pg_tre and pg_re2)"

## Gamification 2.0. Beyond Points and Badges: Designing for Players, Not Metrics. Chapter 5: Implementation

DevFeed: [Gamification 2.0. Beyond Points and Badges: Designing for Players, Not Metrics. Chapter 5: Implementation](<https://devfeed.tech/articles/gamification-2-0-beyond-points-and-badges-designing-for-players-not-metrics-chapter-5-implementation-9080.md>)

Original publisher: [Read original article](<https://uxmag.com/articles/gamification-2-0-beyond-points-and-badges-designing-for-players-not-metrics-chapter-5-implementation>)

Author: Montgomery Singman

Published: 2026-06-09T03:26:13Z

Content type: tutorial

Language: en

Sources: [UX Magazine](<https://devfeed.tech/sources/ux-magazine.md>)

Topics: [implementation](<https://devfeed.tech/topics/implementation.md>), [User experience (UX)](<https://devfeed.tech/topics/ux.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [app](<https://devfeed.tech/tags/app.md>), [building](<https://devfeed.tech/tags/building.md>), [complex-systems](<https://devfeed.tech/tags/complex-systems.md>), [core](<https://devfeed.tech/tags/core.md>), [creative](<https://devfeed.tech/tags/creative.md>), [design](<https://devfeed.tech/tags/design.md>), [expression](<https://devfeed.tech/tags/expression.md>), [games](<https://devfeed.tech/tags/games.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [interface](<https://devfeed.tech/tags/interface.md>), [leaderboard](<https://devfeed.tech/tags/leaderboard.md>), [loops](<https://devfeed.tech/tags/loops.md>), [management](<https://devfeed.tech/tags/management.md>), [multiplayer](<https://devfeed.tech/tags/multiplayer.md>), [puzzle](<https://devfeed.tech/tags/puzzle.md>), [rpg](<https://devfeed.tech/tags/rpg.md>), [sandbox](<https://devfeed.tech/tags/sandbox.md>), [simulation](<https://devfeed.tech/tags/simulation.md>), [strategy](<https://devfeed.tech/tags/strategy.md>), [ux](<https://devfeed.tech/tags/ux.md>)

### AI overview

This chapter presents a practical framework for implementing Gamification 2.0. It recommends choosing a dominant game genre that matches an app's core activities, aligning that genre with user psychology, and designing satisfying intrinsic interaction loops before adding points, badges, or other extrinsic rewards.

### Source excerpt

Part 5 of the "Gamification Series." A framework for developers: from theory to practice Everything I've outlined so far is meaningless if you can't apply it. So let me give you a practical framework for actually implementing Gamification 2.0. Step 1: Stop copying mechanics; choose a genre Your first question isn't "What gamification mechanics should The post Gamification 2.0. Beyond Points and Badges: Designing for Players, Not Metrics. Chapter 5: Implementation appeared first on UX Magazine.

## Nice and Naughty Cases of Pattern Matching

DevFeed: [Nice and Naughty Cases of Pattern Matching](<https://devfeed.tech/articles/nice-and-naughty-cases-of-pattern-matching-23025.md>)

Original publisher: [Read original article](<https://www.javaadvent.com/2025/12/nice-and-naughty-cases-of-pattern-matching.html>)

Author: Cay Horstmann

Published: 2025-12-08T02:02:26Z

Content type: article

Language: en

Sources: [Java Advent Calendar](<https://devfeed.tech/sources/java-advent-calendar.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [2025](<https://devfeed.tech/tags/2025.md>), [article](<https://devfeed.tech/tags/article.md>), [enums](<https://devfeed.tech/tags/enums.md>), [exhaustive](<https://devfeed.tech/tags/exhaustive.md>), [expression](<https://devfeed.tech/tags/expression.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [java](<https://devfeed.tech/tags/java.md>), [java-language](<https://devfeed.tech/tags/java-language.md>), [pattern-matching](<https://devfeed.tech/tags/pattern-matching.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [programming](<https://devfeed.tech/tags/programming.md>), [sealed](<https://devfeed.tech/tags/sealed.md>), [statement](<https://devfeed.tech/tags/statement.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

This article examines Java pattern matching in switch and instanceof, explaining when it fits data-oriented programming, when it becomes an antipattern, and how it interacts with legacy behavior. It uses sealed interfaces, records, enums, and JSON values to illustrate exhaustive pattern matching.

### Source excerpt

Since Java 14, the Java switch and instanceof statements have been enhanced, in multiple phases, to support pattern matching and a "data-oriented" programming style. In this article, I explore when this programming style is beneficial, and why. I look at the sweet spot of perfect pattern usage, absolute antipatterns where it should not be used, [...] The post Nice and Naughty Cases of Pattern Matching appeared first on JVM Advent.

## Ansible Release 12 introduces breaking changes to Jinja2 filters, conditions, macros, and undefined-variable tests

DevFeed: [Ansible Release 12 introduces breaking changes to Jinja2 filters, conditions, macros, and undefined-variable tests](<https://devfeed.tech/articles/ansible-release-12-the-windows-vista-moment-11274.md>)

Original publisher: [Read original article](<https://blog.ipspace.net/2025/11/ansible-12-different/>)

Published: 2025-11-03T06:44:00Z

Content type: opinion

Language: en

Sources: [ipSpace.net blog](<https://devfeed.tech/sources/ipspace-net-blog.md>)

Topics: [Ansible](<https://devfeed.tech/topics/ansible.md>), [releases](<https://devfeed.tech/topics/releases.md>), [configuration](<https://devfeed.tech/topics/configuration.md>)

Tags: [ansible](<https://devfeed.tech/tags/ansible.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [errors](<https://devfeed.tech/tags/errors.md>), [expression](<https://devfeed.tech/tags/expression.md>), [release](<https://devfeed.tech/tags/release.md>)

### AI overview

An opinion article examines breaking behavior changes in Ansible release 12, including stricter when-condition results, changed Jinja2 macro return values, and errors for tests involving undefined variables. The author describes compatibility problems encountered while updating netlab templates.

### Source excerpt

My first encounter with Ansible release 12 wasn't exactly encouraging. We were using a few Ansible Jinja2 filters (ipaddr and hwaddr) in internal netlab templates, and all of a sudden those templates started crashing due to some weird behavior of attributes starting with underscore. We implemented don't use Ansible release 12 as a quick workaround, but postponing painful things is never a good solution(see also: visiting a dentist), so I decided to try to make netlab work with Ansible release 12. What a mistake to make. Read more ...

## Implementing Unsure Calculator in 100 lines of Haskell

DevFeed: [Implementing Unsure Calculator in 100 lines of Haskell](<https://devfeed.tech/articles/implementing-unsure-calculator-in-100-lines-of-haskell-27917.md>)

Original publisher: [Read original article](<http://alt-romes.github.io/posts/2025-04-25-unsure-calculator-in-100-lines-of-haskell.html>)

Published: 2025-04-25T00:00:00Z

Content type: tutorial

Language: en

Sources: [Romes' Musings](<https://devfeed.tech/sources/romes-musings.md>)

Topics: [Haskell](<https://devfeed.tech/topics/haskell.md>), [Development](<https://devfeed.tech/topics/development.md>), [math](<https://devfeed.tech/topics/math.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [expression](<https://devfeed.tech/tags/expression.md>), [haskell](<https://devfeed.tech/tags/haskell.md>), [list](<https://devfeed.tech/tags/list.md>), [monad](<https://devfeed.tech/tags/monad.md>), [numbers](<https://devfeed.tech/tags/numbers.md>), [operations](<https://devfeed.tech/tags/operations.md>), [range](<https://devfeed.tech/tags/range.md>)

### AI overview

This tutorial implements an Unsure Calculator in Haskell. It introduces a range operator for uncertain values, models calculations with a probability monad and normal distributions, samples results using pseudo-randomness, and builds an embedded calculator expression language.

### Source excerpt

Contents 1 Unsure Calculator 1.1 Sampling it up 1.2 Calculator Expressions 1.3 Showing up 1.4 Conclusion 1 Unsure Calculator The recently trendy Unsure Calculator makes reasoning about numbers with some uncertainty just as easy as calculating with specific numbers. The key idea is to add a new "range" operator (written ~) to the vocabulary of a standard calculator. The range x~y denotes that a real value is uncertain, but we are 95% sure that it falls between x and y1. Reading the notation is easy: when you see 10~15, you say: "ten to fifteen". Arithmetic operations and friends (e.g. sin, or log) transparently operate on ranges and literal numbers alike. Calculation results in a plot with a range of values that the input expression can take, and with what frequency. The motivation behind the original article is neat, so I'll just recommend you read it there to learn how and why you'd use such a calculator. Here's a real life example they used: 1400~1700 * 0.55~0.65 - 600~700 - 100~200 - 30 - 20 Now, let's implement it. 1.1 Sampling it up Summon a probability monad from the void2. data Dist a where Return :: a -> Dist a Bind :: Dist b -> (b -> Dist a) -> Dist a Normal :: Double -> Double -> Dist Double instance Monad Dist where (>>=) = Bind instance Applicative Dist where pure = Return; (<*>) = ap instance Functor Dist where fmap = liftM The monad instance is free: pure = Return and (>>=) = Bind. The Normal constructor denotes a normal distribution given the standard deviation and mean. With do-notation we can easily construct a complex tree mixing Returns, Binds, and Normals. For instance: d = do s <- Normal 0 1 return (5 + s) desugars to d = Bind (Normal 0 1) (\s -> Return (5 + s)) Then, embue meaning onto a Dist a by allowing an a to be sampled according to the distribution the Dist represents. We use StdGen from random as a source of uniform pseudo-randomness: sample :: StdGen -> Dist a -> a sample g d = case d of Return x -> x Normal mean std_dev -> n1 * std_dev

## Limit the Scope of Git Diff

DevFeed: [Limit the Scope of Git Diff](<https://devfeed.tech/articles/limit-the-scope-of-git-diff-11136.md>)

Original publisher: [Read original article](<https://blog.ipspace.net/2025/02/limit-scope-git-diff/>)

Published: 2025-02-17T06:41:00Z

Content type: tutorial

Language: en

Sources: [ipSpace.net blog](<https://devfeed.tech/sources/ipspace-net-blog.md>)

Topics: [Git](<https://devfeed.tech/topics/git.md>), [YAML](<https://devfeed.tech/topics/yaml.md>), [Regular expression](<https://devfeed.tech/topics/regular-expression.md>), [BGP](<https://devfeed.tech/topics/bgp.md>)

Tags: [display](<https://devfeed.tech/tags/display.md>), [expression](<https://devfeed.tech/tags/expression.md>), [files](<https://devfeed.tech/tags/files.md>), [flag](<https://devfeed.tech/tags/flag.md>), [git](<https://devfeed.tech/tags/git.md>), [netlab](<https://devfeed.tech/tags/netlab.md>), [parameter](<https://devfeed.tech/tags/parameter.md>), [tests](<https://devfeed.tech/tags/tests.md>), [time](<https://devfeed.tech/tags/time.md>), [worth-reading](<https://devfeed.tech/tags/worth-reading.md>), [yaml](<https://devfeed.tech/tags/yaml.md>)

### AI overview

This article explains how to use Git diff options to identify meaningful changes in YAML-based netlab integration test results when timestamps and version metadata make ordinary diffs noisy. It discusses filtering diffs with a regular expression and limiting output to files or test suites containing relevant changes.

### Source excerpt

The results of netlab integration tests are stored in YAML files, making it easy to track changes improvements with Git. However, once I added the time of test and netlab version to the test results, I could no longer use git diff to figure out which test results changed after a test run - everything changed. For example, these are partial test results from the OSPFv2 tests: Read more ...

## zcommands: Read gzip Compressed Text Files On a Fly on Linux and Unix

DevFeed: [zcommands: Read gzip Compressed Text Files On a Fly on Linux and Unix](<https://devfeed.tech/articles/zcommands-read-gzip-compressed-text-files-on-a-fly-on-linux-and-unix-41964.md>)

Original publisher: [Read original article](<https://www.cyberciti.biz/tips/decompress-and-expand-text-files.html>)

Author: Vivek Gite

Published: 2024-11-01T20:34:07Z

Content type: tutorial

Language: en

Sources: [nixCraft: Linux Tips, Hacks, Tutorials, And Ideas In Blog Format (RSS/FEED)](<https://devfeed.tech/sources/nixcraft-linux-tips-hacks-tutorials-and-ideas-in-blog-format-rss-feed.md>)

Topics: [Linux](<https://devfeed.tech/topics/linux.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Unix](<https://devfeed.tech/topics/unix.md>), [file](<https://devfeed.tech/topics/file.md>), [Regular expression](<https://devfeed.tech/topics/regular-expression.md>)

Tags: [coding](<https://devfeed.tech/tags/coding.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [egrep-command](<https://devfeed.tech/tags/egrep-command.md>), [expression](<https://devfeed.tech/tags/expression.md>), [file](<https://devfeed.tech/tags/file.md>), [grep-command](<https://devfeed.tech/tags/grep-command.md>), [linux](<https://devfeed.tech/tags/linux.md>), [text](<https://devfeed.tech/tags/text.md>), [tip-of-the-day](<https://devfeed.tech/tags/tip-of-the-day.md>), [unix](<https://devfeed.tech/tags/unix.md>)

### AI overview

A tutorial on using z* commands on Linux and Unix to read, search, compare, and inspect gzip-compressed text files without manually decompressing them. It covers commands including zcat, zless, zmore, zgrep, zdiff, zcmp, and znew.

### Source excerpt

Linux and Unix like operating systems comes with z* commands. These commands allow you to read gzip compressed text files using zless, zcat, zmore, and friends commands. The gzip command reduces the size of the files using Lempel-Ziv coding (LZ77). Whenever possible, each file is replaced by one with the extension .gz while keeping the same ownership modes, access, and modification times. z* commands have some cool usage too, such as display the current time in different zonename. Love this? sudo share_on: Twitter - Facebook - LinkedIn - Whatsapp - Reddit The post zcommands: Read gzip Compressed Text Files On a Fly on Linux and Unix appeared first on nixCraft.

## Simplify Complex Boolean Expressions with Meaningful Intermediate Variables

DevFeed: [Simplify Complex Boolean Expressions with Meaningful Intermediate Variables](<https://devfeed.tech/articles/isbooleantoolongandcomplex-23853.md>)

Original publisher: [Read original article](<http://testing.googleblog.com/2024/04/isbooleantoolongandcomplex.html>)

Author: Google Testing Bloggers (noreply@blogger.com)

Published: 2024-04-25T13:14:00Z

Content type: tutorial

Language: en

Sources: [Google Testing Blog](<https://devfeed.tech/sources/google-testing-blog.md>)

Topics: [Code](<https://devfeed.tech/topics/code.md>), [Testing](<https://devfeed.tech/topics/testing.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [code-health](<https://devfeed.tech/tags/code-health.md>), [expression](<https://devfeed.tech/tags/expression.md>), [intermediate](<https://devfeed.tech/tags/intermediate.md>), [post](<https://devfeed.tech/tags/post.md>), [quality](<https://devfeed.tech/tags/quality.md>), [series](<https://devfeed.tech/tags/series.md>), [tott](<https://devfeed.tech/tags/tott.md>), [yiming-sun](<https://devfeed.tech/tags/yiming-sun.md>)

### AI overview

This Code Health article explains how to make complex Boolean expressions easier to understand. It recommends extracting conditions into well-named variables and then grouping details into intermediate Booleans that represent single, well-defined qualities, without changing the business logic.

### Source excerpt

This is another post in our Code Health series. A version of this post originally appeared in Google bathrooms worldwide as a Google Testing on the Toilet episode. You can download a printer-friendly version to display in your office. By Yiming Sun You may have come across some complex, hard-to-read Boolean expressions in your codebase and wished they were easier to understand. For example, let's say we want to decide whether a pizza is fantastic: // Decide whether this pizza is fantastic. if ((!pepperoniService.empty() || sausages.size() > 0) && (useOnionFlag.get() || hasMushroom(ENOKI, PORTOBELLO)) && hasCheese()) { ... } A first step toward improving this is to extract the condition into a well-named variable: boolean isPizzaFantastic = (!pepperoniService.empty() || sausages.size() > 0) && (useOnionFlag.get() || hasMushroom(ENOKI, PORTOBELLO)) && hasCheese(); if (isPizzaFantastic) { ... } However, the Boolean expression is still too complex. It's potentially confusing to calculate the value of isPizzaFantastic from a given set of inputs. You might need to grab a pen and paper, or start a server locally and set breakpoints. Instead, try to group the details into intermediate Booleans that provide meaningful abstractions. Each Boolean below represents a single well-defined quality, and you no longer need to mix && and || within an expression. Without changing the business logic, you've made it easier to see how the Booleans relate to each other: boolean hasGoodMeat = !pepperoniService.empty() || sausages.size() > 0; boolean hasGoodVeggies = useOnionFlag.get() || hasMushroom(ENOKI, PORTOBELLO); boolean isPizzaFantastic = hasGoodMeat && hasGoodVeggies && hasCheese(); Another option is to hide the logic in a separate method. This also offers the possibility of early returns using guard clauses, further reducing the need to keep track of intermediate states: boolean isPizzaFantastic() { if (!hasCheese()) { return false; } if (pepperoniService.empty() && sausages.size()

## Just the right time date predicates with Iceberg

DevFeed: [Just the right time date predicates with Iceberg](<https://devfeed.tech/articles/just-the-right-time-date-predicates-with-iceberg-8713.md>)

Original publisher: [Read original article](<https://trino.io/blog/2023/04/11/date-predicates.html>)

Author: Marius Grama

Published: 2023-04-11T00:00:00Z

Content type: article

Language: en

Sources: [Trino Blog](<https://devfeed.tech/sources/trino-blog.md>)

Topics: [Apache Iceberg](<https://devfeed.tech/topics/apache-iceberg.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [DateTime](<https://devfeed.tech/topics/datetime.md>), [SQL](<https://devfeed.tech/topics/sql.md>)

Tags: [cast](<https://devfeed.tech/tags/cast.md>), [data-lake](<https://devfeed.tech/tags/data-lake.md>), [expression](<https://devfeed.tech/tags/expression.md>), [filter](<https://devfeed.tech/tags/filter.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [partitioning](<https://devfeed.tech/tags/partitioning.md>), [performance](<https://devfeed.tech/tags/performance.md>), [range](<https://devfeed.tech/tags/range.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

This article explains how date predicates can be optimized when querying Iceberg tables in a data lake. It covers partition pruning, hidden partitioning, constant folding, predicate pushdown, range predicates, and casting to help Trino avoid scanning irrelevant data and improve query performance.

### Source excerpt

In the data lake world, data partitioning is a technique that is critical to the performance of read operations. In order to avoid scanning large amounts of data accidentally, and also to limit the number of partitions that are being processed by a query, a query engine must push down constant expressions when filtering partitions.

## Gradle Wrapper Attack Report

DevFeed: [Gradle Wrapper Attack Report](<https://devfeed.tech/articles/gradle-wrapper-attack-report-24708.md>)

Original publisher: [Read original article](<https://blog.gradle.org/wrapper-attack-report>)

Author: Louis Jacomet

Published: 2023-01-25T05:00:00Z

Content type: article

Language: en

Sources: [The Gradle Blog](<https://devfeed.tech/sources/the-gradle-blog.md>)

Topics: [Gradle](<https://devfeed.tech/topics/gradle.md>), [Exploit](<https://devfeed.tech/topics/exploit.md>), [Discord](<https://devfeed.tech/topics/discord.md>), [Regular expression](<https://devfeed.tech/topics/regular-expression.md>)

Tags: [analysis](<https://devfeed.tech/tags/analysis.md>), [attacks](<https://devfeed.tech/tags/attacks.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [developer](<https://devfeed.tech/tags/developer.md>), [discord](<https://devfeed.tech/tags/discord.md>), [exploit](<https://devfeed.tech/tags/exploit.md>), [exploits](<https://devfeed.tech/tags/exploits.md>), [expression](<https://devfeed.tech/tags/expression.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [report](<https://devfeed.tech/tags/report.md>), [third-party](<https://devfeed.tech/tags/third-party.md>)

### AI overview

This report analyzes two suspicious Gradle Wrapper JARs found in MinecraftOnline repositories. The JARs contained exploits that attempted to steal Discord credentials and, in one case, download and execute another malicious JAR that modified a project to inject malicious code and dependencies.

### Source excerpt

On January 11th 2023, we were contacted by MinecraftOnline about two unusual and suspicious Gradle wrapper JARs found in some of their repositories. The wrappers were updated by a new contributor to MinecraftOnline. We've performed an analysis of the JARs and will describe our findings below. We have determined that one exploit was especially crafted as an attack against the MinecraftOnline project. If you are not interested in all of the details, jump immediately to our companion blog covering how to protect your project or you, as a developer, against similar attacks. Analysis Our analysis started by confirming that the SHA256 checksums for both JARs did not match any of the known good Gradle Wrapper checksums: First JAR: 8449b6955690ec956c8ecfe1ae01e10a2aa76ddf18969985c070e345605acce1 Second JAR: 8e129181710bdc045423ddde59244586d7acbc0b2c5e2ddfc098559da559cf85 After decompiling the two JARs, we discovered two exploits had been patched into the wrapper JAR. Discord credentials stealing The first exploit, present in both JARs, attempts to steal Discord credentials by looking into specific files on the host computer. The code is very similar to Discord token logging found online. The exploit hides in different Gradle Wrapper classes and obfuscates String constants through a character array lookup. Using a regular expression, lines from certain files are uploaded to a Discord Webhook using a hardcoded token found in the code. Downloading and running code locally The second JAR contains an additional exploit. On certain Gradle invocations, it will attempt to download another malicious JAR and then run it. For this code path to trigger, the Gradle invocation needed to start with publish or magic. publish is a Gradle task for pushing all project artifacts to a repository. Builds that publish artifacts typically have access to higher privileged credentials. We think that magic was used as a way to test the exploit. Running that JAR resulted in the following actions: Edit

## SSH Hardening to Prevent Brute-Force Attacks

DevFeed: [SSH Hardening to Prevent Brute-Force Attacks](<https://devfeed.tech/articles/ssh-hardening-to-prevent-brute-force-attacks-29870.md>)

Original publisher: [Read original article](<https://goteleport.com/blog/ssh-hardening-to-prevent-brute-force-attacks/>)

Author: info@goteleport.com (Robert Watson)

Published: 2022-01-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Teleport](<https://devfeed.tech/sources/teleport.md>)

Topics: [ssh](<https://devfeed.tech/topics/ssh.md>), [Security](<https://devfeed.tech/topics/security.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [remote access](<https://devfeed.tech/topics/remote-access.md>), [Regular expression](<https://devfeed.tech/topics/regular-expression.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [attacks](<https://devfeed.tech/tags/attacks.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [email](<https://devfeed.tech/tags/email.md>), [expression](<https://devfeed.tech/tags/expression.md>), [fail2ban](<https://devfeed.tech/tags/fail2ban.md>), [filter](<https://devfeed.tech/tags/filter.md>), [hardening](<https://devfeed.tech/tags/hardening.md>), [ip](<https://devfeed.tech/tags/ip.md>), [limit](<https://devfeed.tech/tags/limit.md>), [protection](<https://devfeed.tech/tags/protection.md>), [reduce](<https://devfeed.tech/tags/reduce.md>), [remote-access](<https://devfeed.tech/tags/remote-access.md>), [security](<https://devfeed.tech/tags/security.md>), [server](<https://devfeed.tech/tags/server.md>), [server-logs](<https://devfeed.tech/tags/server-logs.md>), [ssh](<https://devfeed.tech/tags/ssh.md>), [tcp](<https://devfeed.tech/tags/tcp.md>)

### AI overview

This tutorial presents four ways to harden SSH servers against brute-force attacks: limiting authentication attempts, using Fail2ban, and restricting SSH access with TCP wrappers. It also explains how Fail2ban filters server logs and responds to suspicious activity.

### Source excerpt

In this article, we explore and explain four ways to harden SSH from brute-force attacks to help improve security.

## Why Valid Hostname Checks Are More Complex Than a Simple Regular Expression

DevFeed: [Why Valid Hostname Checks Are More Complex Than a Simple Regular Expression](<https://devfeed.tech/articles/what-s-in-a-hostname-30188.md>)

Original publisher: [Read original article](<https://www.netmeister.org/blog/hostnames.html>)

Published: 2021-10-19T02:50:51Z

Content type: article

Language: en

Sources: [Signs of Triviality](<https://devfeed.tech/sources/signs-of-triviality.md>)

Topics: [Regular expression](<https://devfeed.tech/topics/regular-expression.md>)

Tags: [dns](<https://devfeed.tech/tags/dns.md>), [expression](<https://devfeed.tech/tags/expression.md>)

### AI overview

The article explains that validating hostnames is more complicated than using a simple regular expression because hostnames are DNS labels.

### Source excerpt

The common definition of a 'valid hostname' is often reduced to a simple regular expression, but as the saying goes: 'Now you have two problems.' Because hostnames are DNS labels and those... well, it's the DNS. All bets are off.

## The hidden pitfalls of the Elvis operator

DevFeed: [The hidden pitfalls of the Elvis operator](<https://devfeed.tech/articles/the-hidden-pitfalls-of-the-elvis-operator-25887.md>)

Original publisher: [Read original article](<https://medium.com/google-developer-experts/the-hidden-pitfalls-of-the-elvis-operator-da536ba68161?source=rss-1331e67af4e1------2>)

Author: Danny Preussler

Published: 2020-07-28T08:05:18Z

Content type: tutorial

Language: en

Sources: [Stories by Danny Preussler on Medium](<https://devfeed.tech/sources/stories-by-danny-preussler-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [elvis-operator](<https://devfeed.tech/tags/elvis-operator.md>), [expression](<https://devfeed.tech/tags/expression.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [null-safety](<https://devfeed.tech/tags/null-safety.md>), [pitfalls](<https://devfeed.tech/tags/pitfalls.md>), [programming](<https://devfeed.tech/tags/programming.md>), [returning](<https://devfeed.tech/tags/returning.md>)

### AI overview

This Kotlin article explains that the Elvis operator can behave differently from an equivalent if/else statement when chained expressions are involved. Kotlin evaluates the full expression on the left, including the final function call, before deciding whether to evaluate the Elvis branch, so both functions may be called when the final expression returns null.

### Source excerpt

Hidden pitfalls when using Elvis operator I guess many of us love Elvis, both the artist and the operator in Kotlin. But it can lead to some hidden pitfalls if you are not aware of how it works. https://unsplash.com/photos/1LCzr14Ah5U I only realized recently when Vladimir Zdravkovic put some code on twitter and ask us to guess what it's printing: https://twitter.com/vlazdra/status/1287366531987406848?s=20 I assumed a hidden puzzle but I could not see the issue. I could not see any reason why this would print anything but it does! After thinking about the issue (Vladimir wrote an article about it) I found more and more cases where this could go wrong. But let me show you some code: Kotlin's null safety I think most of us love the way we can easily write null safe code with Kotlin like this: presenter?.onDestroy() or data?.let{ updateData(data) } And it is super easy to add an alternative case: data?.let{ updateData(data) } ?: run { showLoadingSpinner() }Let me ask you something Do you think the following code is basically the same as the above? if (data != null) { updateData(data) } else { showLoadingSpinner() } I'm sure most of us do think they are equivalent. But what if I told you, it's not? The if/else is totally binary, it's either-or. But with the Elvis operator, it might be both! To understand why we have to look closer to how it works. Other than the else that belongs explicit to an if , the Elvis operator is not tied to a single ?. Remember, we can chain them: someVariable?.someField?.doSomething() if we now add the Elvis operator here, it will get executed depending on the expression to its left side: someVariable?.someField?.doSomething() ?: run { doSomethingElse() } so if any expression in there is null, the Elvis block will get called. It will finish evaluating everything on the left before checking if the operator is needed. This includes the last expression. So this is depending on whatever doSomething() returns! If it is null, then the right side wil

## Simple Search and Replace in Ruby

DevFeed: [Simple Search and Replace in Ruby](<https://devfeed.tech/articles/simple-search-and-replace-in-ruby-28313.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/ruby/2020/05/14/simple-search-and-replace-in-ruby.html>)

Author: Fuzzygroup

Published: 2020-05-14T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Regular expression](<https://devfeed.tech/topics/regular-expression.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [expression](<https://devfeed.tech/tags/expression.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [search](<https://devfeed.tech/tags/search.md>), [stack-overflow](<https://devfeed.tech/tags/stack-overflow.md>)

### AI overview

A Ruby search-and-replace technique for converting regular-expression matches to strings: use sub or gsub with a literal string instead of a pattern when appropriate.

### Source excerpt

The other day I needed to take some regular expressions and convert them to strings. And while executing a .to_s on the regular expression itself worked correctly it brought through the regular expression characters so there were things like: covid[ -]19 where what I was looking for was just the "covid19" bit (I was generating hashtags from the matched regular expressions for the new CovidNearMe News Aggregator). I started digging into the Ruby string library and didn't find what I was looking for - a str_replace like command. I also experimented a bit with tr but that proved to be misleading at best. Not surprisingly, Stack Overflow came to the rescue and the answer was blindingly simple: Use sub Use gsub but don't specify a pattern; just specify a string. If you don't have: .gsub(/foo/,'bar') but instead .gsub('foo','bar') With this approach, you can then either use sub or gsub depending on how you need the search and replace executed. This is a truly ruby-esque approach and one I should have anticipated.

## Variables, Expressions, and Types

DevFeed: [Variables, Expressions, and Types](<https://devfeed.tech/articles/variables-expressions-and-types-25065.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-variables-expressions-types/>)

Author: author@typealias.com (Dave Leeds)

Published: 2020-03-05T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [developer](<https://devfeed.tech/tags/developer.md>), [expression](<https://devfeed.tech/tags/expression.md>), [fundamentals](<https://devfeed.tech/tags/fundamentals.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [language](<https://devfeed.tech/tags/language.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [programming](<https://devfeed.tech/tags/programming.md>), [statement](<https://devfeed.tech/tags/statement.md>), [types](<https://devfeed.tech/tags/types.md>), [val](<https://devfeed.tech/tags/val.md>), [var](<https://devfeed.tech/tags/var.md>), [variable](<https://devfeed.tech/tags/variable.md>)

### AI overview

An introductory Kotlin chapter explains variables, expressions, and types. It uses the example of a circle's radius to show how variables represent values and introduces variables as containers for numbers and other data in programming.

### Source excerpt

So you want to be a Kotlin developer? You've come to the right place! This book will take you through the fundamentals of Kotlin, gently introducing you to the most important concepts of the language in order to help you become a proficient Kotlin developer. Even if you're a seasoned professional, it's important to know the fundamentals in order to establish a solid foundation of understanding so that you can be as effective as possible.

## A Regular Expression for Validating An Internet Domain

DevFeed: [A Regular Expression for Validating An Internet Domain](<https://devfeed.tech/articles/a-regular-expression-for-validating-an-internet-domain-28296.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/regex/2020/02/03/a-regex-for-an-internet-domain.html>)

Author: Fuzzygroup

Published: 2020-02-03T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Regular expression](<https://devfeed.tech/topics/regular-expression.md>), [Internet](<https://devfeed.tech/topics/internet.md>)

Tags: [blog-post](<https://devfeed.tech/tags/blog-post.md>), [expression](<https://devfeed.tech/tags/expression.md>), [internet](<https://devfeed.tech/tags/internet.md>), [regex](<https://devfeed.tech/tags/regex.md>)

### AI overview

The article corrects an overly broad regular expression for validating Internet domain names. It explains that non-whitespace characters incorrectly allow underscores and presents a pattern using letters, digits, and hyphens in each domain label.

### Source excerpt

Despite the power and truth of Jamie Zawinski's law: Regular Expressions: Now You Have Two Problems Jeff Atwood's Perspective Like Jeff, I too really, really love regular expressions or regexes. I use this one a lot and I finally learned to use \S (Any non-whitespace character) so here's a regex ^\S+\.\S+$ that I wrote yesterday to "validate" the permitted characters in an Internet domain. I was all proud of this and wrote this blog post only to realize that pride really does goeth before a fall - this will NOT correctly validate an Internet domain. As I write this post, I realize that the number of allowed characters in an Internet domain are actually NOT any non-whitespace characters and here's the proof that I actually got that wrong yesterday when I put something online using it: Note: The fact that Rubular allows through an _ which is NOT a valid character in domains is problematic. So the right way to do this, DAMN IT, is something like this: ^[A-Za-z0-9\-]+\.[A-Za-z0-9\-]+$ And this actually works: The [A-Za-z0-9-]+ is a "character class" which says "Any uppercase or lowercase letter plus 0-9 plus a -" are allowed (any order, any quantity)". Regular Expressions - Now you have two problems.

## Optimizing the Casts Away

DevFeed: [Optimizing the Casts Away](<https://devfeed.tech/articles/optimizing-the-casts-away-8616.md>)

Original publisher: [Read original article](<https://trino.io/blog/2019/05/21/optimizing-the-casts-away.html>)

Author: Martin Traverso

Published: 2019-05-21T00:00:00Z

Content type: article

Language: en

Sources: [Trino Blog](<https://devfeed.tech/sources/trino-blog.md>)

Topics: [Optimization](<https://devfeed.tech/topics/optimization.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [analysis](<https://devfeed.tech/tags/analysis.md>), [expression](<https://devfeed.tech/tags/expression.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [sql](<https://devfeed.tech/tags/sql.md>), [types](<https://devfeed.tech/tags/types.md>)

### AI overview

This article explains a new optimization in Presto 312 that removes unnecessary explicit casts introduced by users or by the query planner. It describes how implicit type conversions are represented during planning, why casts complicate predicate pushdown and execution, and how constant expressions can be precomputed to avoid repeated conversions.

### Source excerpt

The next release of Presto (version 312) will include a new optimization to remove unnecessary casts which might have been added implicitly by the query planner or explicitly by users when they wrote the query.

## Capturing specific SSL and TLS version packets using tcpdump(8)

DevFeed: [Capturing specific SSL and TLS version packets using tcpdump(8)](<https://devfeed.tech/articles/capturing-specific-ssl-and-tls-version-packets-using-tcpdump-8-30264.md>)

Original publisher: [Read original article](<https://www.netmeister.org/blog/tcpdump-ssl-and-tls.html>)

Published: 2019-03-08T23:10:46Z

Content type: tutorial

Language: en

Sources: [Signs of Triviality](<https://devfeed.tech/sources/signs-of-triviality.md>)

Topics: [TLS (Transport Layer Security)](<https://devfeed.tech/topics/tls.md>), [SSL](<https://devfeed.tech/topics/ssl.md>)

Tags: [capture](<https://devfeed.tech/tags/capture.md>), [expression](<https://devfeed.tech/tags/expression.md>), [filter](<https://devfeed.tech/tags/filter.md>), [ssl](<https://devfeed.tech/tags/ssl.md>), [tls](<https://devfeed.tech/tags/tls.md>), [version](<https://devfeed.tech/tags/version.md>)

### AI overview

A tcpdump filter expression for capturing SSLv2, SSLv3, and TLS packets below version 1.2.

### Source excerpt

An annoyingly lengthy tcpdump filter expression to capture only SSLv2, SSLv3, and TLS below 1.2 packets.

## Let's Build A Simple Interpreter. Part 8.

DevFeed: [Let's Build A Simple Interpreter. Part 8.](<https://devfeed.tech/articles/let-s-build-a-simple-interpreter-part-8-33329.md>)

Original publisher: [Read original article](<https://ruslanspivak.com/lsbasi-part8/>)

Author: Ruslan Spivak

Published: 2016-01-18T11:10:00Z

Content type: tutorial

Language: en

Sources: [Ruslan Spivak](<https://devfeed.tech/sources/ruslan-spivak.md>)

Topics: [Parsing](<https://devfeed.tech/topics/parsing.md>), [Parser](<https://devfeed.tech/topics/parser.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [constructor](<https://devfeed.tech/tags/constructor.md>), [expression](<https://devfeed.tech/tags/expression.md>), [extend](<https://devfeed.tech/tags/extend.md>), [generate](<https://devfeed.tech/tags/generate.md>), [here](<https://devfeed.tech/tags/here.md>), [node](<https://devfeed.tech/tags/node.md>), [rules](<https://devfeed.tech/tags/rules.md>)

### AI overview

This tutorial explains how to add unary plus and unary minus operators to an interpreter. It covers grammar changes, a UnaryOp abstract syntax tree node, and parser and interpreter updates.

### Source excerpt

Today we'll talk about unary operators, namely unary plus (+) and unary minus (-) operators. A lot of today's material is based on the material from the previous article, so if you need a refresher just head back to Part 7 and go over it again. Remember: repetition is the ...

## Converting Plaid to Kotlin: Lessons learned (Part 2)

DevFeed: [Converting Plaid to Kotlin: Lessons learned (Part 2)](<https://devfeed.tech/articles/converting-plaid-to-kotlin-lessons-learned-part-2-27215.md>)

Original publisher: [Read original article](<https://antonioleiva.com/plaid-kotlin-2>)

Published: 2015-11-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [Antonio Leiva](<https://devfeed.tech/sources/antonio-leiva.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Android](<https://devfeed.tech/topics/android.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [callback](<https://devfeed.tech/tags/callback.md>), [code](<https://devfeed.tech/tags/code.md>), [expression](<https://devfeed.tech/tags/expression.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [map](<https://devfeed.tech/tags/map.md>), [maps](<https://devfeed.tech/tags/maps.md>), [when-expression](<https://devfeed.tech/tags/when-expression.md>)

### AI overview

Part 2 of a series about porting the Plaid Android app to Kotlin. It examines how Kotlin can reduce boilerplate and improve readability, including class simplification, when expressions, map operations, and converting Retrofit callbacks into lambdas.

### Source excerpt

Everything Android, Kotlin and other random topics

## Let's Build A Simple Interpreter. Part 6.

DevFeed: [Let's Build A Simple Interpreter. Part 6.](<https://devfeed.tech/articles/let-s-build-a-simple-interpreter-part-6-33327.md>)

Original publisher: [Read original article](<https://ruslanspivak.com/lsbasi-part6/>)

Author: Ruslan Spivak

Published: 2015-11-02T12:00:00Z

Content type: tutorial

Language: en

Sources: [Ruslan Spivak](<https://devfeed.tech/sources/ruslan-spivak.md>)

Topics: [Parsing](<https://devfeed.tech/topics/parsing.md>), [syntax](<https://devfeed.tech/topics/syntax.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [expression](<https://devfeed.tech/tags/expression.md>), [lexer](<https://devfeed.tech/tags/lexer.md>), [recursion](<https://devfeed.tech/tags/recursion.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [tokens](<https://devfeed.tech/tags/tokens.md>)

### AI overview

This tutorial extends an arithmetic-expression grammar to support parenthesized expressions with arbitrarily deep nesting. It updates the lexer and interpreter to evaluate expressions containing integers and arithmetic operators.

### Source excerpt

Today is the day :) "Why?" you might ask. The reason is that today we're wrapping up our discussion of arithmetic expressions (well, almost) by adding parenthesized expressions to our grammar and implementing an interpreter that will be able to evaluate parenthesized expressions with arbitrarily deep nesting, like the expression ...

## Let's Build A Simple Interpreter. Part 5.

DevFeed: [Let's Build A Simple Interpreter. Part 5.](<https://devfeed.tech/articles/let-s-build-a-simple-interpreter-part-5-33326.md>)

Original publisher: [Read original article](<https://ruslanspivak.com/lsbasi-part5/>)

Author: Ruslan Spivak

Published: 2015-10-14T11:00:00Z

Content type: tutorial

Language: en

Sources: [Ruslan Spivak](<https://devfeed.tech/sources/ruslan-spivak.md>)

Topics: [Compiler](<https://devfeed.tech/topics/compiler.md>), [Parser](<https://devfeed.tech/topics/parser.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [build](<https://devfeed.tech/tags/build.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [expression](<https://devfeed.tech/tags/expression.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [programming](<https://devfeed.tech/tags/programming.md>), [programming-languages](<https://devfeed.tech/tags/programming-languages.md>), [writing-code](<https://devfeed.tech/tags/writing-code.md>)

### AI overview

This tutorial explains how to build an interpreter that parses and evaluates arithmetic expressions. It covers operator associativity and precedence for addition, subtraction, multiplication, and division, using expressions such as "14 + 2 * 3 - 6 / 2".

### Source excerpt

How do you tackle something as complex as understanding how to create an interpreter or compiler? In the beginning it all looks pretty much like a tangled mess of yarn that you need to untangle to get that perfect ball. The way to get there is to just untangle it ...

## Deriving the Reddit Formula

DevFeed: [Deriving the Reddit Formula](<https://devfeed.tech/articles/deriving-the-reddit-formula-37888.md>)

Original publisher: [Read original article](<https://www.evanmiller.org/deriving-the-reddit-formula.html>)

Author: Evan Miller

Published: 2015-07-14T15:15:00Z

Content type: article

Language: en

Sources: [Evan Miller](<https://devfeed.tech/sources/evan-miller.md>)

Topics: [Reddit](<https://devfeed.tech/topics/reddit.md>), [math](<https://devfeed.tech/topics/math.md>), [Users](<https://devfeed.tech/topics/users.md>)

Tags: [analysis](<https://devfeed.tech/tags/analysis.md>), [expression](<https://devfeed.tech/tags/expression.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [math](<https://devfeed.tech/tags/math.md>), [reddit](<https://devfeed.tech/tags/reddit.md>), [theory](<https://devfeed.tech/tags/theory.md>)

### AI overview

Evan Miller derives a Reddit "hot" formula using expected-utility theory. The analysis explains the formula's constants, logarithm, absolute value, and lack of current time, estimates optimization for users who visit every 5.43 hours, and proposes a caveated amendment.

### Source excerpt

Deriving the Reddit Formula -- What can expected-utility theory tell us about Reddit's "hot" formula?

## The Many Faces of Set Cover

DevFeed: [The Many Faces of Set Cover](<https://devfeed.tech/articles/the-many-faces-of-set-cover-40382.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2015/05/04/the-many-faces-of-set-cover/>)

Published: 2015-05-04T09:00:00Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Algorithms, Complexity](<https://devfeed.tech/topics/algorithms-complexity.md>), [Regular expression](<https://devfeed.tech/topics/regular-expression.md>), [Databases](<https://devfeed.tech/topics/databases.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [approximation-algorithms](<https://devfeed.tech/tags/approximation-algorithms.md>), [expression](<https://devfeed.tech/tags/expression.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [np](<https://devfeed.tech/tags/np.md>), [np-hard](<https://devfeed.tech/tags/np-hard.md>), [programming](<https://devfeed.tech/tags/programming.md>), [regex](<https://devfeed.tech/tags/regex.md>), [regex-golf](<https://devfeed.tech/tags/regex-golf.md>), [regular-expressions](<https://devfeed.tech/tags/regular-expressions.md>), [set-cover](<https://devfeed.tech/tags/set-cover.md>)

### AI overview

This tutorial explains the set cover problem and connects it to regex golf. It shows how selected regular expressions can be combined to cover desired strings while avoiding unwanted matches, and notes that set cover is NP-hard, motivating approximation algorithms.

### Source excerpt

A while back Peter Norvig posted a wonderful pair of articles about regex golf. The idea behind regex golf is to come up with the shortest possible regular expression that matches one given list of strings, but not the other. "Regex Golf," by Randall Munroe. In the first article, Norvig runs a basic algorithm to recreate and improve the results from the comic, and in the second he beefs it up with some improved search heuristics.

[Next page](<https://devfeed.tech/tags/expression.md?cursor=WyIyMDE1LTA1LTA0VDA5OjAwOjAwKzAwOjAwIiwgIjlmZjQxMmFhLTAzZmQtNGQxYi1iYmQ0LTEzY2Y5MzJhYTg3NSJd>)