zak
06-12-2008, 11:53
hi
due to the limitation of vbscript described in:
http://www.regular-expressions.info/vbscript.html
i want to call perl regular expressions from within thinbasic
i have a vb6 small program to call a perl script so to provide the matches positions(match start, match end) of a pattern globally through a string. the perl script is converted to an activex dll by the activestate perl development kit PDK
please how i can call this activex dll from thinbasic?
i enclosed the vb6 program together with patternposition.dll and the small perl script "template.pl"
the vb6 code is:
Private Sub Command1_Click()
sentence$ = Text1.Text
ptrn$ = Text2.Text
Dim objpattern
Dim chk
Set objpattern = CreateObject("patternposition.Library")
Rem calling the procedure ptrnois within the patternposition.dll
chk = objpattern.ptrnpos(sentence$, ptrn$)
Text3.Text = Text3.Text & chk & vbCrLf
Set objpattern = Nothing
End Sub
i wish vbscript may be replaced in the future by may be the pcre library which are compatible with perl
here is a compiled dll for pcre but i can't manage to use it.
http://gnuwin32.sourceforge.net/packages/pcre.htm
also the activestate dev kit is a commercial one, while the pcre is free.
the returned position from the patternposition.dll in the example is 3,4,20,24,27,28 ie the positions of the first match is 3,4 the second is 20,24...
for a string "to be or not aboze sbxxyer be"
and a pattern: (?<!a)b.*?e
thanks
the vb6 source and the activex dll together with perl source
note that we need to register the DLL by regsvr32
http://ifile.it/glh0ira/vb_perl_regex.rar
due to the limitation of vbscript described in:
http://www.regular-expressions.info/vbscript.html
i want to call perl regular expressions from within thinbasic
i have a vb6 small program to call a perl script so to provide the matches positions(match start, match end) of a pattern globally through a string. the perl script is converted to an activex dll by the activestate perl development kit PDK
please how i can call this activex dll from thinbasic?
i enclosed the vb6 program together with patternposition.dll and the small perl script "template.pl"
the vb6 code is:
Private Sub Command1_Click()
sentence$ = Text1.Text
ptrn$ = Text2.Text
Dim objpattern
Dim chk
Set objpattern = CreateObject("patternposition.Library")
Rem calling the procedure ptrnois within the patternposition.dll
chk = objpattern.ptrnpos(sentence$, ptrn$)
Text3.Text = Text3.Text & chk & vbCrLf
Set objpattern = Nothing
End Sub
i wish vbscript may be replaced in the future by may be the pcre library which are compatible with perl
here is a compiled dll for pcre but i can't manage to use it.
http://gnuwin32.sourceforge.net/packages/pcre.htm
also the activestate dev kit is a commercial one, while the pcre is free.
the returned position from the patternposition.dll in the example is 3,4,20,24,27,28 ie the positions of the first match is 3,4 the second is 20,24...
for a string "to be or not aboze sbxxyer be"
and a pattern: (?<!a)b.*?e
thanks
the vb6 source and the activex dll together with perl source
note that we need to register the DLL by regsvr32
http://ifile.it/glh0ira/vb_perl_regex.rar