Currency Symbol with Word Pattern Check

Description

This rule checks for redundant or incorrect combinations of the dollar symbol ($) with the written forms "dollars", "USD", or "US dollars". This kind of redundancy is stylistically incorrect and can create confusion. The proper way to write currency amounts is to either use the symbol ($) OR the word form, but not both together.

Examples

This rule will flag patterns like:

  • $50 dollars ❌ (redundant use of both symbol and word)
  • $100 USD ❌ (redundant use of symbol with USD)
  • $25 US dollars ❌ (redundant use of symbol with written form)

Correct alternatives would be:

  • $50
  • 50 dollars
  • USD 50
  • 50 USD

The rule uses a regular expression to match any instance where a dollar symbol is followed by any number (optional) and then the words "dollars", "usd", or "us dollars" (case insensitive).

Rule Source

This rule comes from: https://github.com/mesosphere/dcos-docs-site

Rule Definition

extends: existence
message: "Incorrect use of symbols in '%s'."
ignorecase: true
raw:
  - \$[\d]* ?(?:dollars|usd|us dollars)