Skip to main content
Version: 0.18.0

withTextRegex

production

Filters for texts, which match the regex pattern.

Examples:

'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true

// this filters any text that contains 'pie' or 'cake' or 'Pie' or 'Cake'
await aui.get().text().withTextRegex('.*([Pp]ie|[Cc]ake).*').exec();

  • @param {string} regex_pattern - A regex pattern