I basically need to to set up a regular expression with this code so when i open my txtfile.text it finds all the differrent acronyms and when it does extract the whole line that the acronym is in here is a sample of my text file and a sample of my code any help would be highly appreciated
"C FB S DS FG AS PIPE" these RE ACRONYMS THE ONES NOT LISTED IN MY TEXT FILE WOULD NOT GET WROTE TO A NEW SELECTED TEXT FILE?
========================================================
TEXT FILE:
16 Atec Bill Line 1 23 2 1 PL 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 C 45888 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 FB 47875 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 STD 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 L 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 S 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 TUBING 2323 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 C 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 C 1132 5 18' 11 1/8 1209 A 36 45.89 tns
===============================================================================
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ofd4.ShowDialog()
Const ForReading = 1
Const ForWriting = 2
Const forAppending = 8
objFSO = CreateObject("Scripting.FileSystemObject")
objFile = objFSO.OpenTextFile(Me.txtFile.Text, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
If InStr(strLine, "C") Then
strNewContents = strNewContents & strLine & vbCrLf
End If
Loop
objFile.Close()
objFile = objFSO.OpenTextFile(ofd4.FileName, forAppending)
objFile.Write(strNewContents)
objFile.Close()
"C FB S DS FG AS PIPE" these RE ACRONYMS THE ONES NOT LISTED IN MY TEXT FILE WOULD NOT GET WROTE TO A NEW SELECTED TEXT FILE?
========================================================
TEXT FILE:
16 Atec Bill Line 1 23 2 1 PL 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 C 45888 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 FB 47875 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 STD 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 L 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 S 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 TUBING 2323 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 C 45 5 18' 11 1/8 1209 A 36 45.89 tns
16 Atec Bill Line 1 23 2 1 C 1132 5 18' 11 1/8 1209 A 36 45.89 tns
===============================================================================
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ofd4.ShowDialog()
Const ForReading = 1
Const ForWriting = 2
Const forAppending = 8
objFSO = CreateObject("Scripting.FileSystemObject")
objFile = objFSO.OpenTextFile(Me.txtFile.Text, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
If InStr(strLine, "C") Then
strNewContents = strNewContents & strLine & vbCrLf
End If
Loop
objFile.Close()
objFile = objFSO.OpenTextFile(ofd4.FileName, forAppending)
objFile.Write(strNewContents)
objFile.Close()