ReEscape result doesn't match ACF

Description

ACF:

Ortus BoxLang Version: 1.0.0-snapshot+2929 (Built On: 2025-02-14 01:13:34)

Activity

Show:

Brad Wood February 20, 2025 at 10:56 PM

Do these two test satisfy your needs?

John Whish February 15, 2025 at 10:09 AM

It’s an ACF thing - Lucee doesn’t have it as far as I know.

Funnily enough I saw today that escaping for regular expressions is a Stage 3 proposal for ECMAScript. Here are some links if of interest.

Brad Wood February 14, 2025 at 10:48 PM

Cool, here’s CF code I’ve used for this in the past (I TOTALLY didn’t know this BIF existed!)

We can probably just adapt that.

John Whish February 14, 2025 at 9:44 PM
Edited

I found it due to our ACF tests failing when running on BoxLang. I think it might be related to POSIX classes…?

ACF will output:

********[:upper:]

BoxLang will output:

[:upper:]****[:upper:]

So an edge case!

Brad Wood February 14, 2025 at 8:34 PM

Is this causing an actual issue. The BoxLang output (which comes directly from the Java regex libs is technically correct. Here’s ChatGTP’s explaination:

In Java regex, \Q...\E is used to quote (escape) a sequence of characters, treating them as literal text rather than as special regex metacharacters.

So, the regex \Q[]{}()\E is equivalent to:

CopyEdit

\[\]\{\}\(\)

which matches exactly the string []{}(), interpreting the brackets, braces, and parentheses as literal characters instead of their usual regex meanings.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created February 14, 2025 at 1:08 PM
Updated February 20, 2025 at 10:56 PM
Resolved February 20, 2025 at 10:56 PM