Thanks in advance. What i currently have is a filedialog box selecting a text file. The text file contents will look like example.txt, and it needs to look like output.txt. NOTE: the string CoreDBConnectString= is 1 line all the way to ;Database=Source_DB.
example.txt [Information] Date= CreatedBy= Unique=eqwe-asd-123-as12-3 CoreDataSource= CoreDBConnectString=Provider=SQLOLEDB.1;Server=Server;Integrated Security=SSPI;Database=Source_DB NoteDataSource=SQLServer NoteDBConnectString=Provider=Provider=SQLOLEDB.1;Server=Server;Integrated Security=SSPI;Database=Source_DB CoreDBCaseID=99 NoteDBCaseID=99 Output.txt Table=99 (Comes from CoreDBCaseID) Server=Server (comes from the string CoreDBConnectString=) Security=SSPI (comes from the string CoreDBConnectString=) Database=Source_DB (comes from the string CoreDBConnectString=)
You can do something like this:
And a quick way to learn those regular expressions:
Regular Expression Cheat Sheet
Regular-Expressions.info
You can use a positive lookahead to stop matching at the (;) character. Something like this:
@”Security=(?[\D]+)(?=;)”