Skip to content

Commit

Permalink
tom updated RegEx for complete connection names
Browse files Browse the repository at this point in the history
For pwsh.
  • Loading branch information
silverqx committed Sep 9, 2024
1 parent ea5525f commit 3a58ca1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tom/src/tom/commands/completecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,15 +731,16 @@ QStringList CompleteCommand::getConnectionNamesFromFile()
std::string line;
line.reserve(256);

static const QRegularExpression regex(uR"T("(\w+)".*// shell:connection$)T"_s);
static const QRegularExpression
regex(uR"T("(?<connection>[\w\.-]+)".*// shell:connection$)T"_s);

// No need to care about \r\n at the end
while (getline(mainFileStream, line))

if (const auto match = regex.match(QString::fromStdString(line));
match.hasMatch()
)
connectionNames << match.captured(1);
connectionNames << match.captured(u"connection"_s);

mainFileStream.close();

Expand Down

0 comments on commit 3a58ca1

Please sign in to comment.