Skip to content

pluralize() throws on BoxLang for words ending in -ex, -lf or -rf #4185

Closed

Description

@bpamiri

On BoxLang, pluralize() throws for common words ending in -ex or in -lf / -rf:

pluralize("vertex")  // Index -1 out of bounds for length 4
pluralize("index")   // same
pluralize("half")    // Index -1 out of bounds for length 5
pluralize("shelf")   // same
pluralize("wolf")    // same

Lucee and Adobe ColdFusion return vertices, indices, halves, shelves and wolves. Because model names and association names go through pluralize(), a model named Shelf or Index can fail on BoxLang.

Cause. Two pluralize rules in vendor/wheels/global/strings.cfm combine alternatives in a single regex, and only one alternative sets group 1:

  • (matr|vert|ind)ix|ex$ → \1ices. For vertex the ex$ alternative matches, so \1 is unset.
  • (?:([^f])fe|([lr])f)$ → \1\2ves. For half the ([lr])f alternative matches, so \1 is unset.

Lucee and Adobe replace an unset group with an empty string. BoxLang throws.

Fix. Split each rule into two, so every group a replacement refers to takes part in its match. Output on Lucee and Adobe is unchanged.

Activity

  1. added this to the v4.2.0 milestone on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions