I have a command string in which the middle part should be ignored.
Example:
settings:volume:save
Using QRegularExpression, I need an expression that returns true as soon as the first part of the command contains "settings", and the last part contains "save". The part in the middle does not matter.
I tried the below, but it does not work:
command = "settings:volume:save";
QRegularExpression regex("(^settings\..*_save$)");
if (regex.match(command).hasMatch())
//match code
Maybe don't use regexp and do like:
If you are fan on regexp, use: