regexComponentSeparator top-level constant

String const regexComponentSeparator

A regular expression pattern that matches whitespace-flexible comma separators. This pattern is designed to handle the standard format of CSS color functions like rgb(), rgba(), hsl(), etc.

Pattern breakdown:

  • \s* : Zero or more whitespace characters before the comma
  • , : Required comma separator
  • \s* : Zero or more whitespace characters after the comma

Examples of matching patterns:

  • , => matches
  • , => matches
  • , => matches
  • \t,\n => matches
  • ; => doesn't match
  • => doesn't match

Usage in color functions:

// In rgb() function
"rgb(255, 128, 0)"      // matches
"rgb(255,128,0)"        // matches
"rgb(255  ,  128,  0)"  // matches

Implementation

const regexComponentSeparator = r'\s*,\s*';