regexp->replaceFirst
Replaces the first match.
Target
Signature
1regexp->replaceFirst(...)Replaces the first match.
regexp->replaceFirst is called with member syntax on a receiver value. regexp->replaceFirst uses the regular-expression surface for pattern matching. Keep patterns small, name the intent in nearby code, and test captures separately from replacement strings.
Parameters
...- Additional values may be supplied after the earlier arguments.
Examples
Basic call
1regexp('[0-9]+', '', 'a1b2')->replaceFirst('#')The example shows the normal call shape. Adapt variable names, validation, and surrounding error handling to the context.