Extension: Regular Expressions#476
Merged
jwklong merged 18 commits intoJan 17, 2026
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
lastIndexand other such things. It also uses Arrays and Objects, meaning blocks produce output that works with those extensions directly.lastIndexis mutable by design.