Regex problem ...

Posted by carlos on Stack Overflow See other posts from Stack Overflow or by carlos
Published on 2010-05-11T19:52:28Z Indexed on 2010/05/11 19:54 UTC
Read the original article Hit count: 229

Filed under:
|

hello i have the next regex

     Dim origen As String = "  /c /p:""c:\mis doc umentos\mis imagenes construida\archivo.txt"" /cid:45    423 /z:65 /a:23  /m:39 /t:45rt "

Dim str As String = "(^|\s)/p:""\w:(\\(\w+[\s]*\w+)+)+\\\w+.\w+""(\s|$)"
                    Dim ar As Integer

                    Dim getfile As New Regex(str)
                    Dim mgetfile As MatchCollection = getfile.Matches(origen)
                    ar = mgetfile.Count

When i evaluate this it works, and gets the /p:""c:\mis doc umentos\mis imagenes construida\archivo.txt"" that basically is the path to a file.

But if I change the origen string to

Dim origen As String = "  /c /p:""c:\mis doc umentos\mis imagenes construida\archivo.txt""/cid:45    423 /z:65 /a:23  /m:39 /t:45rt "

Check that the end of the file is follow by "/cid:45" whitchs makes de patter invalid, but insted of getting a mgetfile.count = 0 the program is block, if i make a debug I got a property evaluation failed.

Thanks for your comments !!!

© Stack Overflow or respective owner

Related posts about regex

Related posts about vb.net