CyberArmy University | Open Source Institute | CyberArmy Intelligence & Security | CyberArmy Services & Projects

ok ok


[Replies] [Reply] [View by Thread] [Help]
[Back To Programming]

Posted by Ker sefo On 2008-07-28 08:11:23
In Reply to RE: VBscript is easy Posted by Beta Tr chiken On 2008-07-28 06:36:15

Ker
Ker sefo


Then you just replace the pattern:
.Pattern = "\W" 'equivalent to [^a-zA-Z_0-9]
~

On 2008-07-28 06:36:15, chiken wrote
>Correct me if i'm wrong but doesn't
>
>
 
>Public Function noPunct(thestring)
>	Set RegularExpressionObject = New RegExp
>	With RegularExpressionObject
>	    .Pattern = "\s|[,.!?-]"
>	    .IgnoreCase = True
>	    .Global = True
>	End With
>	noPunct = RegularExpressionObject.Replace(thestring, "")
>	Set RegularExpressionObject = nothing
>End Function
>

>only look for ,.!? and - ? What happens the punctuation is not one of those? I'd look into modifying your code to where everything except for a letter is invalid.
>
>
>On 2008-07-24 14:16:19, sefo wrote
>>

>>Dim line, tmpLine, str, testStr, a1()
>>
>>Set fs = CreateObject("Scripting.FileSystemObject")
>>Set a = fs.CreateTextFile("output.txt", True)
>>
>>Set objFSO = CreateObject("Scripting.FileSystemObject")
>>Set objFile = objFSO.OpenTextFile("input.txt", 1)
>>Do Until objFile.AtEndOfStream
>>    line = objFile.Readline
>>    testStr = noPunct(line)
>>    tmpLine = testStr
>>    testStr = reverseWord(testStr)
>>    If LCase(testStr) = LCase(tmpLine) Then
>>	a.WriteLine(line)
>>    End If
>>Loop
>>
>>a.Close
>>
>>Public Function reverseWord(ByVal str)
>>	strlen = Len(str)
>>	ReDim a1(strlen - 1)
>>	For i = 0 to strlen - 1
>>	    a1(i) = Right(str,1)
>>	    str = Left(str,Len(str)-1)
>>	Next
>>	reverseWord = Join(a1,"")
>>End Function
>>
>>Public Function noPunct(thestring)
>>	Set RegularExpressionObject = New RegExp
>>	With RegularExpressionObject
>>	    .Pattern = "\s|[,.!?-]"
>>	    .IgnoreCase = True
>>	    .Global = True
>>	End With
>>	noPunct = RegularExpressionObject.Replace(thestring, "")
>>	Set RegularExpressionObject = nothing
>>End Function
>>



Replies:


Guest:
Subject:
Message:
Signature:
Optional Image Link:
http://

CyberArmy::Forum v0.6
Generated In 0.03839 seconds


About Us | Privacy Policy | Mission Statement | Help