.. _functx_replace-beginning: ======================== functx:replace-beginning ======================== Replaces the beginning of a string, up to a matched pattern Description ~~~~~~~~~~~ The functx:replace-beginning function replaces the beginning of $arg (up to and including the first area that matches $pattern) with $replacement. If no area matches the pattern, no replacement is made. .. list-table:: :widths: 40 60 :header-rows: 1 * - **Parameters** - **Description** * - arg:string() - the entire string to change * - pattern:string() - the pattern of characters to replace up to * - replacement:string() - the replacement string Examples ~~~~~~~~ .. list-table:: :widths: 50 50 :header-rows: 1 * - **XPath** - **Results** * - functx:replace-beginning('abc-def', '-', 'xxx') - xxxdef * - functx:replace-beginning('abc-def', '-', '') - def * - functx:replace-beginning('---abc', '[a-z]', 'x') - xbc * - functx:replace-beginning('2004-12-05', '-', '2005-') - 2005-12-05 See Also ~~~~~~~~ .. toctree:: :titlesonly: :glob: * :ref:`functx_replace-first`. * :ref:`replace`.