Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting

Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 10-07-2012, 01:40 AM
danielo515 danielo515 is offline
Registered User
Join Date: Sep 2012
Posts: 2
VBS - Regular Expression WEIRD BUG

Hello everybody.

I just want to report something that is pretty unusual.

May the scenario that I show here is a little bit, twisted, but here it is:
I'm using Secure CRT and Visual Basic for scripting.

I have a function to deal with regular expressions, like this, which returns an array.

function Expresion( registro, patron )
dim resultado
Set re = New RegExp
re.Pattern = patron
re.Multiline = False
re.IgnoreCase = False
resultado = ""
				If re.Test(registro) = True Then ' si coincide con la expresión que buscamos
					msgbox "comenzando teste"
					Set matches = re.Execute(registro) ' devuelve una colección de coincidencias
					For Each match In matches ' el match contiene toda la expresión regular que coincide, en este caso esperamos que sea sólo una
						msgbox match.submatches(0)
						resultado =resultado & match.SubMatches(0) & " " ' el submatches contiene sólo lo que estaba entre paréntesis
				End If		

 	Expresion = split(resultado)
end function

Ok, I want some user input from a prompt message to use with this function, and also I want to take te returned array. Everything normal If I do like this

ips = Expresion(crt.Dialog.Prompt("Input that","IPS",vbDefaultButton),"(\d{1,3}̇\d{1,3}̇\d{1,3}̇\d{1,3}(/\d+)?)" )

Ok, marvelous, works,

But if i do like this

ips = Expresion(crt.Dialog.Prompt("Text to long for a single line so i will split this","IPS",vbDefaultButton),_
"(\d{1,3}̇\d{1,3}̇\d{1,3}̇\d{1,3}(/\d+)?)" )
The regular expression matches just white spaces.

Is this a know issue?
Reply With Quote

scripting , secure crt , visual basic

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 01:40 PM.