luca345
asked on
Simulate 'Like' operator with RegEx
Hi
I need to simulate the vb 'like' operator with a new equivalent function.
I was try to use this function:
//
Public Shared Function LikeOp(ByVal inputString As String, ByVal PatternString As String) As Boolean
Return System.Text.RegularExpress ions.Regex .IsMatch(i nputString , PatternString)
End Function
//
but return different result and is not the exact 'like' equivalent.
Someone can please help me to fix this function ?
Best Regards
I need to simulate the vb 'like' operator with a new equivalent function.
I was try to use this function:
//
Public Shared Function LikeOp(ByVal inputString As String, ByVal PatternString As String) As Boolean
Return System.Text.RegularExpress
End Function
//
but return different result and is not the exact 'like' equivalent.
Someone can please help me to fix this function ?
Best Regards
Why can't you use the LIKE operator directly?
Public Shared Function LikeOp(ByVal inputString As String, ByVal PatternString As String) As Boolean
Return (inputString LIKE PatternString)
End Function
ASKER
I need to operate in VB and C# in the some mode.
C# don't have the 'like' operator but in my vb project there are many calls.
I need to fix the LikeOp function with some result of original 'like'.
I don't known how is difficoult do this.
Can you help me please ?
C# don't have the 'like' operator but in my vb project there are many calls.
I need to fix the LikeOp function with some result of original 'like'.
I don't known how is difficoult do this.
Can you help me please ?
You could create a VB.NET DLL that contains the LikeOp method (using the LIKE operator), and then you can reference it on your other projects.
ASKER
Yes, But create a DLL for only one function is not good idea.
I think there are alternatives, I hope.
I think there are alternatives, I hope.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is a solution.
I have already thinked about it.
This is and VB6 library and in the future will be certanly removed.
I have recently migrated from VB6 to vB.net and for this reason I like to use only .NET library.
If there are not other solutions this can be good.
I have already thinked about it.
This is and VB6 library and in the future will be certanly removed.
I have recently migrated from VB6 to vB.net and for this reason I like to use only .NET library.
If there are not other solutions this can be good.
ASKER
Someone can confirm if:
Microsoft.VisualBasic.Comp ilerServic es.LikeOpe rator.Like String
is supported by mono project please ?
Microsoft.VisualBasic.Comp
is supported by mono project please ?
ASKER
I Have find myself an equivalent function that use regex.
However thank you.
However thank you.
ASKER
Good
This function is called soundex. Two strings w1 and w2 look alike when they have the same soundex value: soundex (w1) == soundex (w2).
Hoping this helps.