# extra

Published articles for extra.

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

## Make regular expressions easier to read

DevFeed: [Make regular expressions easier to read](<https://devfeed.tech/articles/make-regular-expressions-easier-to-read-37309.md>)

Original publisher: [Read original article](<https://muffinman.io/blog/make-regular-expressions-easier-to-read/>)

Author: Stanko

Published: 2025-03-31T00:00:00Z

Content type: tutorial

Language: en

Sources: [Stanko Tadić](<https://devfeed.tech/sources/stanko-tadic.md>)

Topics: [Code](<https://devfeed.tech/topics/code.md>), [formatting](<https://devfeed.tech/topics/formatting.md>), [Maintainability](<https://devfeed.tech/topics/maintainability.md>)

Tags: [example](<https://devfeed.tech/tags/example.md>), [extra](<https://devfeed.tech/tags/extra.md>), [join](<https://devfeed.tech/tags/join.md>), [maintainability](<https://devfeed.tech/tags/maintainability.md>), [readability](<https://devfeed.tech/tags/readability.md>), [regular-expressions](<https://devfeed.tech/tags/regular-expressions.md>), [value](<https://devfeed.tech/tags/value.md>)

### AI overview

The article presents a formatting technique for making complex regular expressions easier to read: split the expression into multiple string components, join them, and construct the final regex. The approach adds code and requires escaping backslashes, but enables scanning and comments that can improve readability and maintainability.

### Source excerpt

This is a simple formatting trick I use to make regular expressions more readable. The secret? Break them into multiple lines. To achieve this, format the regex as an array of strings and then concatenate the array into a single regex string. Example # Compare this example, written in a single line: const FILTER_REGEXP = /(?<name>blur|brightness|contrast|grayscale|hue-rotate|invert|opacity|saturate|sepia)\((?<value>-?\d*(?:\.\d*)?)(?<unit>\w*?)\)/g; with the multi-line version: const SUPPORTED_FILTERS = [ 'blur', 'brightness', 'contrast', 'grayscale', 'hue-rotate', 'invert', 'opacity', 'saturate', 'sepia', ].join('|'); const FILTER_REGEXP = new RegExp( [ `(?<name>${SUPPORTED_FILTERS})`, // filter name `\\(`, `(?<value>\-?\\d*(?:\\.\\d*)?)`, // value `(?<unit>\\w*?)`, // unit if any `\\)`, ].join(''), 'g' ); The multi-line version has a bit more code, but it's easier to scan and read. It also allows us to write comments for each section, clarifying the purpose of each part of the regex. I've found that complex expressions are much easier to write this way. I believe it greatly reduces the cognitive load for both the writer and the reader. Caveats # You'll need to escape the backslashes in regex strings. While this is a minor inconvenience, the readability benefits easily outweigh it. Conclusion # It boils down to personal preference, but I believe the extra code is worth it, as it improves readability and maintainability. This is especially true when dealing with notoriously difficult-to-parse complex regular expressions.

## Installing mozjpeg on Ubuntu 16.04 & 18.04 (Forge)

DevFeed: [Installing mozjpeg on Ubuntu 16.04 & 18.04 (Forge)](<https://devfeed.tech/articles/installing-mozjpeg-on-ubuntu-16-04-18-04-forge-31274.md>)

Original publisher: [Read original article](<https://nystudio107.com/blog/installing-mozjpeg-on-ubuntu-16-04-forge>)

Author: andrew@nystudio107.com (Andrew Welch)

Published: 2016-12-14T00:57:00Z

Content type: tutorial

Language: en

Sources: [nystudio107 | Articles on modern web development.](<https://devfeed.tech/sources/nystudio107-articles-on-modern-web-development.md>)

Topics: [Ubuntu](<https://devfeed.tech/topics/ubuntu.md>), [Content Management System](<https://devfeed.tech/topics/cms.md>)

Tags: [16-04](<https://devfeed.tech/tags/16-04.md>), [18-04](<https://devfeed.tech/tags/18-04.md>), [compression](<https://devfeed.tech/tags/compression.md>), [extra](<https://devfeed.tech/tags/extra.md>), [forge](<https://devfeed.tech/tags/forge.md>), [here-s](<https://devfeed.tech/tags/here-s.md>), [images](<https://devfeed.tech/tags/images.md>), [insights](<https://devfeed.tech/tags/insights.md>), [install](<https://devfeed.tech/tags/install.md>), [jpeg](<https://devfeed.tech/tags/jpeg.md>), [mile](<https://devfeed.tech/tags/mile.md>), [mozjpeg](<https://devfeed.tech/tags/mozjpeg.md>), [optimizing](<https://devfeed.tech/tags/optimizing.md>), [ubuntu](<https://devfeed.tech/tags/ubuntu.md>), [want](<https://devfeed.tech/tags/want.md>)

### AI overview

A tutorial for installing mozjpeg on Ubuntu 16.04 or 18.04 through Forge, including building it with CMake and configuring the Craft CMS Imager plugin. The article reports lossless image-size savings compared with jpegoptim.

### Source excerpt

If you want to go the extra mile optimizing your images, here's how to install mozjpeg on Ubuntu 16.04 or 18.04 (Forge)