Repository navigation
fix(lstsv): emit regex() as regexMatch('/pat/', x) - #245
Merged
Merged
Conversation
… delimited
LimeSurvey's regexMatch(pattern, input) needs a delimited pattern (PHP
preg_match, JS RegExp). regex(x, 'pat') now becomes
regexMatch('/^(?:pat)$/', x): `/` is escaped, and the pattern is anchored
because ODK matches the whole value while LimeSurvey searches. The reverse
reads this back to regex(x, 'pat') and still accepts the old field-first
form. The bare-regexMatch escape hatch delimits its pattern too.
Fixes #218.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jstet
force-pushed
the
fix/regexmatch-218
branch
from
November 4, 2026 20:10
9cee121 to
fbd410c
Compare
Merged
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.
Fixes #218.
LimeSurvey's `regexMatch(pattern, input)` takes the pattern first and needs it delimited (`/…/`). We emitted `regexMatch(self, 'pat')`, so the constraint was wrong for every input. Checked against the LimeSurvey source: PHP `exprmgr_regexMatch` runs `preg_match($pattern . 'u', $input)`, and JS `LEMregexMatch` strips `/…/flags` before `RegExp.test`.
Before:
```
regex(., '^[0-9]{5}$') -> regexMatch(self, '^[0-9]{5}$')
regex(., '[0-9]{5}') -> regexMatch(self, '[0-9]{5}')
```
After:
```
regex(., '^[0-9]{5}$') -> regexMatch('/^[0-9]{5}$/', self)
regex(., '[0-9]{5}') -> regexMatch('/^(?:[0-9]{5})$/', self)
```
The `testB` snapshot changed only in its two email-regex constraint rows (blessed and diff inspected). Not run against a live LimeSurvey here; the issue's live valid/invalid test is still worth doing.
Tests
🤖 Generated with Claude Code