HIghlight named capture in regex find string

This commit is contained in:
1024jp 2021-08-01 22:59:32 +09:00
parent 96b53723b4
commit ca527b3014
2 changed files with 13 additions and 3 deletions

View File

@ -2,6 +2,15 @@
Change Log
==========================
4.0.7 (unreleased)
--------------------------
### Improvements
- Highlight named capture where highlight regular expression patterns such as in the find panel.
4.0.6 (465)
--------------------------

View File

@ -8,7 +8,7 @@
//
// ---------------------------------------------------------------------------
//
// © 2018-2020 1024jp
// © 2018-2021 1024jp
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -85,7 +85,7 @@ enum RegularExpressionSyntaxType {
// -> [abc] will be extracted in ranges(in:) since regex cannot parse nested []
return [
escapeIgnorer + "\\.", // .
escapeIgnorer + "\\\\" + "[^AbGZzQE1-9]", // all escaped characters
escapeIgnorer + "\\\\" + "[^AbGkZzQE1-9]", // all escaped characters
escapeIgnorer + "\\\\" + "[sdDefnrsStwWX]", // \s, \d, ...
escapeIgnorer + "\\\\" + "v", // \v
escapeIgnorer + "\\\\" + "\\\\", // \\
@ -102,10 +102,11 @@ enum RegularExpressionSyntaxType {
return [
escapeIgnorer + "\\$[0-9]", // $0
escapeIgnorer + "\\\\[1-9]", // \1
escapeIgnorer + "\\\\k<[a-zA-Z][a-zA-Z0-9]+>", // \k<name>
]
case .symbol:
return [
escapeIgnorer + "\\(\\?(:|>|#|=|!|<=|<!|-?[ismwx]+:?)", // (?...
escapeIgnorer + "\\(\\?(:|>|#|=|!|<=|<!|-?[ismwx]+:?|<[a-zA-Z][a-zA-Z0-9]*>)", // (?...
escapeIgnorer + "[()|]", // () |
escapeIgnorer + "(\\[\\^?|\\])", // [^ ]
escapeIgnorer + "\\\\[QE]", // \Q ... \E