| 77 | } |
| 78 | |
| 79 | void MacroActionVariable::HandleRegexSubString(Variable *var) |
| 80 | { |
| 81 | const auto curValue = var->Value(); |
| 82 | auto regex = _subStringRegex.GetRegularExpression(_regexPattern); |
| 83 | if (!regex.isValid()) { |
| 84 | return; |
| 85 | } |
| 86 | |
| 87 | auto it = regex.globalMatch(QString::fromStdString(curValue)); |
| 88 | const auto regexMatchIndex = _regexMatchIdx.GetValue() - 1; |
| 89 | for (int idx = 0; idx < regexMatchIndex; idx++) { |
| 90 | if (!it.hasNext()) { |
| 91 | return; |
| 92 | } |
| 93 | it.next(); |
| 94 | } |
| 95 | |
| 96 | if (!it.hasNext()) { |
| 97 | return; |
| 98 | } |
| 99 | |
| 100 | auto match = it.next(); |
| 101 | var->SetValue(match.captured(0).toStdString()); |
| 102 | } |
| 103 | |
| 104 | void MacroActionVariable::HandleFindAndReplace(Variable *var) |
| 105 | { |
nothing calls this directly
no test coverage detected