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.

Parameters

Description

arg:string()

the string to test

pattern:string()

the regular expression

Examples

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