Skip to content

Extension: Regular Expressions#476

Merged
jwklong merged 18 commits into
PenguinMod:mainfrom
DogeisCut:extension-dogeiscutRegularExpressions
Jan 17, 2026
Merged

Extension: Regular Expressions#476
jwklong merged 18 commits into
PenguinMod:mainfrom
DogeisCut:extension-dogeiscutRegularExpressions

Conversation

@DogeisCut

@DogeisCut DogeisCut commented Jan 17, 2026

Copy link
Copy Markdown
Collaborator

I know what you're thinking, "We already have a regex extension". However, this one is different, it's built for PenguinMod, using PenguinMod APIs and it's feature complete (as in, it implements everything regex has to offer, as far as I know).

The whole system revolves around Regex being a new type, allowing support for lastIndex and other such things. It also uses Arrays and Objects, meaning blocks produce output that works with those extensions directly.

lastIndex is mutable by design.

image msedge_I8XLfzAxnn image

Extended the RegExp wrapper class with additional getters for flags and properties (hasIndices, ignoreCase, multiline, unicode, unicodeSets, lastIndex, source) and implemented exec and test methods. Default return values for invalid expressions were standardized to false or 0 where appropriate.
Updated regular expression blocks to use 'PATTERN' instead of 'EXPRESSION' and added support for regex flags. Improved RegularExpressionType methods for better display and handling, and added HTML escaping utility.
Introduces new blocks for regex test, exec, search, split, replace, replaceAll, match, and matchAll operations on strings. Refactors RegularExpressionType to use a 'regex' property instead of 'expression', updates static and instance methods, and improves compatibility with external array and object types. Also updates block shapes and argument handling for better integration.
Introduces handling for the lastIndex property in RegularExpressionType, including constructor, getter, setter, and related extension blocks. This enables getting and setting lastIndex for regular expressions, improving compatibility with RegExp behavior.
Added serializer registration for dogeiscutRegularExpression, enabling serialization and deserialization of regex objects with source, flags, and lastIndex. Also updated block definitions and improved object conversion logic.
Wrapped calls to String.prototype.replaceAll and matchAll in try-catch blocks to prevent runtime errors when non global expressions are used. Now returns an empty array on error instead of throwing.
Introduces a 'Regular Expressions' extension description, banner image, and menu icon.
Added 'source of' and 'flags of' reporter blocks for regex objects. Updated the color and icon for the extension. Improved dependency handling with an 'Add Missing Dependencies' button and adjusted block palette logic. Simplified error handling in some blocks to return empty strings instead of empty objects or arrays.
Removed the isValid property and refactored RegularExpressionType to streamline construction and flag handling. Enhanced toRegularExpression to better support various input formats and improved flag filtering. Simplified property getters and methods to remove unnecessary validity checks.
Introduces a new reporter block 'regex escape [STRING]' to escape special characters in strings for use in regular expressions. Also adds a TODO for a RegExp.escape polyfill.
Reorganized the block definitions for clarity and logical grouping. Also commented out the return value in setLastIndex to match expected behavior.
Introduces a custom ScratchBlocks shape 'dogeiscutRegularExpressions-RegularExpression' for regular expression blocks and arguments, replacing the previous 'SCRAPPED' shape. This enhances visual distinction and consistency for regular expression-related blocks in the DogeisCut extension.
@vercel

vercel Bot commented Jan 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
penguinmod-extensions-gallery Ready Ready Preview Jan 17, 2026 5:28am

@jwklong
jwklong merged commit 452949d into PenguinMod:main Jan 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants