Lots of Data strings [ imported ] where users have entered text like "Instagram" or "Facebook" or https:// http and url data.
Data Invalid to be fed to major holiday portals..
What is the simplest way to parse this data from a string besides a lot of DO CASE, SUBSTR At(
Regex sounds good but how to use in VO.?
Phil
Regex type functionality in VO or Vulcan...
Regex type functionality in VO or Vulcan...
Phil McGuinness
Regex type functionality in VO or Vulcan...
Hi Phil,
in VO, I use the hs_regex.dll.
Wolfgang
in VO, I use the hs_regex.dll.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Regex type functionality in VO or Vulcan...
Wolfgang
Is there a Vo wrapper or use examples somewhere?
Reading now.. sounds promising
Phil
Is there a Vo wrapper or use examples somewhere?
Reading now.. sounds promising
Phil
Phil McGuinness
Regex type functionality in VO or Vulcan...
Hi Phil,
here is both my library and the DLL: And this is the code behind a button to check if an expression is covered by the regular expression:
HTH
Wolfgang
here is both my library and the DLL: And this is the code behind a button to check if an expression is covered by the regular expression:
Code: Select all
method CheckRegEx( oExpression as EnhancedSLE, oTest as EnhancedSLE, oResult as EnhancedSLE ) as logic pascal class DokTabEdit
local cExpression as string
local cTest as string
local oRegex as clsHs_RegEx
local lMatch as logic
cExpression := AllTrim( oExpression:Value )
if SLen( cExpression ) == 0
ErrBox( self, "no expression" )
self:SetFocusDelayed( oExpression )
return false
endif
cTest := AllTrim( oTest:Value )
if SLen( cTest ) == 0
ErrBox( self, "no test value" )
self:SetFocusDelayed( oTest )
return false
endif
debOut( "Compare " + cTest + " to " + cExpression )
oRegex := clsHs_RegEx{ cExpression, 3 }
lMatch := oRegex:Match( cTest )
oRegex:CleanUp()
if lMatch
oResult:Value := "fits"
else
oResult:Value := "does NOT fit"
endif
return lMatch
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Regex type functionality in VO or Vulcan...
Here we go:
You can use Microsoft VBScript Regular Expressions 5.5 library in VO 2.8 - 2838 as in the the following example. The library is normally installed in Windows, so you won't have to install yourself.
Note: in earlier versions of VO, you need to use OleAutoObject instead of OleAutoObjectEx.
The above is late bound object, if you want to create a strongly typed class, you can generate an Automation Server classes for the various classes contained in the library.
You can use Microsoft VBScript Regular Expressions 5.5 library in VO 2.8 - 2838 as in the the following example. The library is normally installed in Windows, so you won't have to install yourself.
Note: in earlier versions of VO, you need to use OleAutoObject instead of OleAutoObjectEx.
Code: Select all
local o as object
local Str1 := "jam@asder.com" as string
local Str2 := "jam@asder" as string
o := OleAutoObjectEx{ "VBScript.RegExp"}
if o:fInit
o:@@global := true
o:ignorecase := true
o:Pattern := "^([a-zA-Z0-9_-.]+)@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$"
If o:test(Str1)
? "Valid email address", Str1
Else
? "Invalid email address", Str1
EndIf
If o:test(Str2)
? "Valid email address", Str2
Else
? "Invalid email address", Str2
EndIf
endif
o := NULL_OBJECT
Regex type functionality in VO or Vulcan...
OleAutoObjectEx{ "VBScript.RegExp"}
Ok... see what you are doing.
I will write a wrapper around the native DLL ..
Using mySQL REGEX built it and some other hack code I can move on.
Over the immediate problem.
Will come back to this.. Thanks
Ok... see what you are doing.
I will write a wrapper around the native DLL ..
Using mySQL REGEX built it and some other hack code I can move on.
Over the immediate problem.
Will come back to this.. Thanks
Phil McGuinness