|
The keyword "Like" in VB actually is a very weak form of regular expression. The performance problem here is that you are iterating through every single character. With a proper regular expression you can match against the whole string in one go.
You need to create a new Regex object, and set it up with the required pattern string.
then you can call Match on the regex object and check the Success flag.
To work out the pattern string you need to use, look at the MSDN link I provided in my last reply.
You can find a reference to the regular expression pattern language here[^]
Also, try working through this tutorial[^] to start you off.
Simon
|
|
|
|
|
try this
Private Function validatedata(data As String) As Boolean
Dim innlop As Integer
For innlop = 1 To Len(data)
If IsNumeric(Mid(data, innlop, 1)) = False Then
validatedata = False
Exit Function
End If
validatedata = True
Next
End Function
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi,
Thanks good help, but can u please help me in doing the same by using the Regular Expression object.
Thanks,
Aleem Mohammad.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
try to implement your self
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi,
Can anybody please tell me the pattern to take only the integer values as numerics and decimal values not. Like "90009" should be taken as numeric and "900.09" should be taken as non numeric.
Just give me one pattern.
Thanks,
Aleem Mohammad.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
No one here is going to do your job for you for free.
I will be happy to write the code for you, but you will have to pay me my standard hourly rate of £1000 per hour.
If you don't want to pay, you will have to figure it out yourself. I've guided you as much as I can, I've given you links to all the information you need. You now need to go away and read those links and understand what needs doing.
Good luck.
Simon
|
|
|
|
|
Hi,
Can u please help whether I have any method or preperty in RegExp class to check if our expression is matching with the pattern, am asking u this as am new to VB 6.0. And intellisense is also not working for this object in my editor.
Thanks,
Aleem Mohammad.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
|
And if that isn't enough, download something like Expresso to help you test the expressions.
Cheers!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
kissdznuts wrote: download something like Expresso
I second that. It is a great tool, I have found it helpful many of times when dealing with regular expressions.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi,
Is it free download or costs some thing and another one is, can I replace some of the characters not matching with my regular expression, with null string.
If it is then it will be of great help for me.
Thanks,
Aleem Mohammad.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
indian143 wrote: it free download
Ummm, yes it is. Familiarize yourself with the search textbox at the top of this forum.
Here is your assignment: type in the word Expresso and then hit the Go! button. Hint: there are two articles done by Jim Hollenhorst that are both excellent.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Paul 'FTW'!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
My assignment for him can't be that hard. Fine quotation from Mr. Garrison.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Free registration to unlock Expresso.
Enjoy!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Ok thanks for the help I got it but only one thing in last I want to ask you in this series is : please give me a pattern to mis the special characters like "@", "#" etc.
I have done it as below its working fine for charates, float all, but giving true when I add "@" or "#" to it. Can u please help in this.
Set objRegExp = New VBScript_RegExp_10.RegExp
With objRegExp
.Pattern = "\d{" & iLen & "}"
.IgnoreCase = True
.Global = True
End With
If iLen > 0 Then
If (objRegExp.Test(sTemp) = True) Then
IsNumericOnly = True
End If
End If
Thanks a Lot,
Aleem Mohammad.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
hi all,
i run a query which update a field , is failed when it contains single or double quote.Otherwise it is running successfully. sample query is following
update table1 set name='abcd'efg'
please suggest how can i solve this problem ?
|
|
|
|
|
sunil goyalG wrote: update table1 set name='abcd'efg'
try this
update table1 set name='abcd\'efg'
' and \ are excape characters so one has to put "\" before them to send as proper query
|
|
|
|
|
This solution is not works for me. query is failed. I am using SQL Server Express 2005
|
|
|
|
|
use the instant of ' Asc char. It will work i also tried in my system it is working properly .
Ananda
|
|
|
|
|
Perfect Query
update table1 set name='abcd''efg'
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Any time you are updating a column which may contain a single quote, you must scan and replace the single quote with two single quotes. If your column contains 5 single quotes, your column will contain 10 single quotes after the scan and replace. During the update, two successive single quotes will be converted back to a single quote. For example, if your column contains 'abc'd''ef' before the scan and replace, your column will contain 'abc''d''''ef' after the scan and replace. After the update, your column in the database will contain your original column value namely 'abc'd''ef'.
bigsagal, confused as all get out!
|
|
|
|
|
THe problem is that you are using string concantenation (newString = "SomeString" & "SomeOtherString") to build your SQL statement. Don't. Use parameterized queries instead and this problem is solved for you. Read this[^] article for why you should not be doing what you're doing and how to use parameters.
|
|
|
|
|
I done one vb.net application which includes typed dataset (using SQL Server)
Dragged one required database table on to the xsd(typed dataset) and right click select query then
sqlstatement and then insert method and modified the populated query as required .
And in the code i am using the method(insert) created in the xsd(typed dataset)
The application is working fine in my local machine but when i moved the application to client machine (which uses another database but table and columns names and keys all are similar) there i am getting an exception
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections."
I also changed the database name in configuaration file (connection string-autogenerated when drag a table)
Please help on this and Thanks in advance.
|
|
|
|
|
i think this is not a dataset problem.,
first check the database connection in your client pc
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|