.. _functx_number-of-matches: ======================== functx:number-of-matches ======================== The number of regions that match a pattern Description ~~~~~~~~~~~ The functx:number-of-matches function counts the number of times a string matches a particular pattern (regular expression). It does not count overlapping regions. .. list-table:: :widths: 40 60 :header-rows: 1 * - **Parameters** - **Description** * - arg:string() - the string to test * - pattern:string() - the regular expression Examples ~~~~~~~~ .. list-table:: :widths: 50 50 :header-rows: 1 * - **XPath** - **Results** * - functx:number-of-matches('abcabc','ab') - 2 * - functx:number-of-matches('12345','\d') - 5 * - functx:number-of-matches('aaaaaa','aaa') - 2 See Also ~~~~~~~~ .. toctree:: :titlesonly: :glob: * :ref:`matches`.