ZenoTest
ZenoTest — Windows Desktop UI Testautomatisierung für Qt, WPF, WinForms & native Apps. Aufzeichnen, skripten und automatisierte GUI-Tests mit CI/CD-Integration ausführen.

RegexMatch

string RegexMatch(string text, string pattern)

Description
Searches text for the first occurrence of pattern and returns the matched substring.
If the pattern contains capture groups (...), the content of the first capture group is returned.
If no match is found, an empty string is returned and an info message is logged.
An invalid pattern causes a script error.

Parameter
- text - The input string to search in.
- pattern - The regular expression pattern.

Returns
The matched substring or first capture group as a string, or an empty string if no match was found.

Example
void main()
{
    string m1 = RegexMatch("Version 3.14", "\\d+\\.\\d+");  // "3.14"
    string m2 = RegexMatch("user@mail.com", "(\\w+)@");      // "user"  (1st group)
    string m3 = RegexMatch("abc", "\\d+");                   // ""      (no match)
}
#define #include abs Array ceil CloseAUT Console mode do...while DoubleClick DragAndDrop Execute Fail File floor for Format GetAUTFileVersion GetAUTProductVersion GetAUTQtVersion GetAUTSuspectedCompiler GetAUTSuspectedFramework GetClipboard GetCurrentDate GetCurrentTime GetCurrentWorkingDir GetEnv GetName GetProcessID GetProcessIDHandle GetQtProperty GetText GetTimestamp GetValue Handle HasFocus IsAUT64Bit IsChecked IsEnabled IsVisible LeftMouseClick LeftMouseDown LeftMouseUp max MiddleMouseClick MiddleMouseDown MiddleMouseUp min MouseMove MouseWheel Pass pow Predefined Constants Print rand Regex RegexMatch RightMouseClick RightMouseDown RightMouseUp round Script Language SendKeys SendMessage SetClipboard SetFocus SetNotFoundBehavior SetQtProperty ShellProcess Sleep sqrt srand StartAUT string TerminateProcess TimerStart TimerStop TimerVerifyLess vec2d VerifyContains VerifyEmpty VerifyEndsWith VerifyEqual VerifyExists VerifyFalse VerifyGreater VerifyGreaterEqual VerifyLess VerifyLessEqual VerifyNotEqual VerifyNotExists VerifyScreenCompareEdgeBased VerifyScreenComparePixelExact VerifyStartsWith VerifyTrue WaitForControl WaitUntilEnabled WaitUntilVisible while