updated regex to match service by data-service attribute in html anchor tags
This commit is contained in:
parent
147445df66
commit
7740822918
1 changed files with 2 additions and 2 deletions
4
utils.js
4
utils.js
|
|
@ -6,11 +6,11 @@ import sanitizeHtml from 'sanitize-html'
|
||||||
// helper functions
|
// helper functions
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
||||||
// regex to match service name within an html anchor tag
|
// regex to match service by data-service attribute within an html anchor tag
|
||||||
// used when linkFormat is 'html' in config.js
|
// used when linkFormat is 'html' in config.js
|
||||||
export function htmlServiceLinkRegex(serviceName) {
|
export function htmlServiceLinkRegex(serviceName) {
|
||||||
return new RegExp(
|
return new RegExp(
|
||||||
`(<a[^>]+href=["'][^"']*["'][^>]*>)${serviceName}(<\\/a>)`,
|
`(<a[^>]*data-service=["']${serviceName}["'][^>]*>)([^<]*)(<\\/a>)`,
|
||||||
'i',
|
'i',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue