KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to match (in this snippet) everything upto but not including a newline which is what I thought a . would do. Could someone shed light on what I'm missing please. Public Sub regexp() Dim oRegExp As regexp Dim oMatches As MatchCollection Dim oMatch As Match Dim sString As String sString = _ "one" & vbNewLine & _ "two" & vbNewLine Set oRegExp = New regexp With oRegExp .Global = True .Pattern = ".+" Set oMatches = .Execute(sString) For Each oMatch In oMatches Debug.Print "*" & oMatch.Value & "*" Next oMatch End With End Sub Output is *one * *two * Expected output *one* *two* How can I avoid the newline in the output? Thanks.
Tags (comma-separated)
Save Edits
Cancel