The search string begins with FL followed by 1 to 3 numbers, the second of which may contain a space.
If different, please state more precisely
Code: Select all
EnableExplicit
; RegEx cut to make it easier to understand :-)
#RegEx = "FL\h+(\d+)" +
"(?:\h+(\d\h?\d+))?" +
"(?:\h+(\d+))?"
Define Txt$ = ~"string.s=\"FL 565 860 500\"" +
"but perhaps also" +
~"string.s=\"FL 565 860 \"" +
"Or" +
~"string.s=\"FL 500\"" +
~"Var1=\"FL 500 1 500 »" +
"ou var1 = « FL 500 1 500 »" +
"ou tout simplement" +
"var = « FL 500 »" +
"deux variables" +
"500 et 1500"
If Not CreateRegularExpression(0, #RegEx) : Debug "Bad ReGex" : End : EndIf
If Not ExamineRegularExpression(0, Txt$) : Debug "No match" : End : EndIf
Define A$, B$, C$
While NextRegularExpressionMatch(0)
A$ = RegularExpressionGroup(0, 1)
B$ = RemoveString(RegularExpressionGroup(0, 2), " ")
C$ = RegularExpressionGroup(0, 3)
Debug A$ + " " + B$
Debug C$
Debug "-----------------------------------"
Wend
FreeRegularExpression(0)
End
If any number can contain spaces, this can also, but differently
Are numbers greater than 999 also less than 100,000?
Is this data for converting flight plans?: FL : Flight Level ? (in which case it's easier)
To make things easier for us, please provide us with a list of the lines that must match and a list of those that must not.