Reqular Expressions
-
Hello coders, I am trying to seperate one line of vb code into lines by vbcrlf (carriage return - linefeed) or the colon : characther As you know Dim i: i=3 statements are exactly the same as Dim i i=3 I have the following code to be seperated. Dim input As String = "Function X(i As String):Dim q As integer=" & vbCrLf & "Dim P as byte" Normally , If I use the Dim pattern As String = "[\n|.*:*.]" pattern it will be seperated into three lines (as I wanted) But If I use the following line , it will be into 4 lines (I do not want it to be happened) Dim input As String = "Function X(i As String):Dim q As integer=""q:p""" & vbCrLf & "Dim P as byte" I need to modify the pattern, which will not accept colons inside quotes. How can I do that? Thank you for you time Emre YAZICI Best Regards Emre YAZICI
-
Hello coders, I am trying to seperate one line of vb code into lines by vbcrlf (carriage return - linefeed) or the colon : characther As you know Dim i: i=3 statements are exactly the same as Dim i i=3 I have the following code to be seperated. Dim input As String = "Function X(i As String):Dim q As integer=" & vbCrLf & "Dim P as byte" Normally , If I use the Dim pattern As String = "[\n|.*:*.]" pattern it will be seperated into three lines (as I wanted) But If I use the following line , it will be into 4 lines (I do not want it to be happened) Dim input As String = "Function X(i As String):Dim q As integer=""q:p""" & vbCrLf & "Dim P as byte" I need to modify the pattern, which will not accept colons inside quotes. How can I do that? Thank you for you time Emre YAZICI Best Regards Emre YAZICI
Use a group like this: ("".*:.*"") to match a colon within quotes. Then fit that in so it will find those anywhere, and ignore them. Christian Graus - Microsoft MVP - C++