Dim St As String = “string pulled from the textfile suing reader which has key : text I want to keep - end of my string”
Dim pFrom As Integer = St.IndexOf("key : ") + "key : “.Length
Dim pTo As Integer = St.LastIndexOf(” - ")
Dim result As String = St.Substring(pFrom, pTo - pFrom)
Note: “key :” and " -" are the two string of the string’s starting and end which we need to search and get.
we can return the result to the workflow and can use it.
Retrieve the data from the file. This will be assigned to a string variable strContent
Find index of the text from where the data need to be copied. Consider your search text is saved in a string variable strStartSearchText and index is stored in an integer variable intStartIndex
intStartIndex = strContent.IndexOf(strStartSearchText)
Find index of the text where the data copying should be stopped. Consider your search text is saved in a string variable strEndSearchText and index is stored in an integer variable intEndIndex
intEndIndex = strContent.IndexOf(strEndSearchText)
Find length of startindex to endindex and assign it to an int variable, intLength
intLength = intEndIndex - intStartIndex + 1
Find substring of the text. Consider your resultant data will be assigned to a string variable strResult
strResult = strContent.Substring(intStartIndex, intLength)
how to extract the value from string where
input String : “10 11301CD1 2 Irrigation Adaptor, for machine
cleaning, reusable,
for use with Flexible Intubation Video
Endoscopes 11301 BNX and 11302 BDX
Country of origin: EE”
Output String: “Irrigation Adaptor, for machine
cleaning, reusable,
for use with Flexible Intubation Video
Endoscopes 11301 BNX and 11302 BDX”
Where only "Country of origin " string is fixed. Also the length for characters may vary.
yes tried through “(?=^([0-9]* [0-9A-Z]* [0-9])).(?=Country of origin:)” but getting output produced is "10 11301CD1 2 Irrigation Adaptor, for machine cleaning, reusable, for use with Flexible Intubation Video Endoscopes 11301 BNX and 11302 BDX " since required output is "Irrigation Adaptor, for machine cleaning, reusable, for use with Flexible Intubation Video Endoscopes 11301 BNX and 11302 BDX " .