473,505 Members | 14,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

let non dotnet COM client resuing regex

jg
I need to reuse regex pattern or let non dotnet com client to reuse the
pattern to match against different strings, what is the best way?
How should I free up the resources held by regex?

Right now, I am leaning towards this way

Private Dim RegexCollection as New Microsoft.VisualBasic.Collection()
Private Function makekey(ByVal strPrefx As String) As String

return strPrefx + ToString(Microsoft.VisualBasic.DateAndTime.Timer) +
ToString(Rnd())

End Function

Public function getRegex(strPattern As String, ByRef strKey as String) As
Object ' leaning to use the key to deal with collection

strKey = makekey("regex")

RegexCollection .add(New Regex(strPattern), strKey)

return RegexCollection (strKey)

End Function

Public Function free_RegexObj(ByRef myobj As Object, ByRef mykey As
String)
Try
RegexCollection .Remove(mykey)
myobj.destroy()
mykey = Nothing
Return 0
Catch ex As Exception
Return -1
End Try
End Function

Public function getMatch(str2search As String, ioffset As Integer,
strRegexkey as String, byRef strRegexObj as Object,
ByRef iFoundPos as Integer. ByRef iFoundLen as integer) as integer
.................

' if found return 1 and....
....

' otherwise
return -1
End Function
Is there a better way?

Nov 21 '05 #1
0 744

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
2892
by: bill | last post by:
I am trying to convince a client that dotNet is preferable to an Access project (ADP/ADE). This client currently has a large, pure Access MDB solution with 30+ users, which needs to be upgraded....
4
2206
by: nitc3 | last post by:
How to access script tag attributes in asp.net from code behind? Thanks in advance Nitc
3
1704
by: Geoff | last post by:
I need to keep a few VB6 tcpClients active, but have them talk to a dotNet tcpServer/tcpListener. The "Server"/Listener is running as a Plugin, and needs to respond to "outside requests". The...
22
381
by: bill | last post by:
I am trying to convince a client that dotNet is preferable to an Access project (ADP/ADE). This client currently has a large, pure Access MDB solution with 30+ users, which needs to be upgraded....
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.