T
teo
Hallo
I need to move the first char of a new line
to the last position of the previous line.
The char to move is always the squared bracket: ]
--- Example, I have: ---
Paul and Mary [chapter one
]
The boys went to school.
--- I need to have: ---
Paul and Mary [chapter one]
The boys went to school.
I presume I need to concatenate the ending char of the previuos line
to the first char of the new line, remove the old vbCrLf between them,
then set the new vbCrLf after the squared bracket.
I'm trying to accomplish this by RegEx,
but I have problems.
I'm able to match by using ^]
but
I'm not able to replace.
Below is the code,
what I have to insert instead of ######## ?
---- ---- ----
Dim MyRegex As New Regex("^]", RegexOptions.IgnoreCase Or
RegexOptions.Multiline)
Dim myText As String = ""
myText = "Paul and Mary [chapter one
]
The boys went to school."
Dim myMatches As MatchCollection = myRegex.Matches(myText)
For Each myMatch As Match In myMatches
Debug.Print (myText)
myText = Replace(myText, myMatch.Value, "########")
Debug.Print (myText)
Next
I need to move the first char of a new line
to the last position of the previous line.
The char to move is always the squared bracket: ]
--- Example, I have: ---
Paul and Mary [chapter one
]
The boys went to school.
--- I need to have: ---
Paul and Mary [chapter one]
The boys went to school.
I presume I need to concatenate the ending char of the previuos line
to the first char of the new line, remove the old vbCrLf between them,
then set the new vbCrLf after the squared bracket.
I'm trying to accomplish this by RegEx,
but I have problems.
I'm able to match by using ^]
but
I'm not able to replace.
Below is the code,
what I have to insert instead of ######## ?
---- ---- ----
Dim MyRegex As New Regex("^]", RegexOptions.IgnoreCase Or
RegexOptions.Multiline)
Dim myText As String = ""
myText = "Paul and Mary [chapter one
]
The boys went to school."
Dim myMatches As MatchCollection = myRegex.Matches(myText)
For Each myMatch As Match In myMatches
Debug.Print (myText)
myText = Replace(myText, myMatch.Value, "########")
Debug.Print (myText)
Next