Name Age University Pass/Fail
Peter 20 abcUniversity Pass
Terry 19 xyzUniversity Fail
Failed in Course 005
Chris 21 tyuUniveristy Pass
I have already using the SubString to extract the data above but without the “Failed in Course 005”. Is there any way to also extract the next line after the phrase “Fail”? The way I want is the final column of Terry to be “Fail Failed in Course 005”
Step 1: Create a sequence.
Step 2: Insert an Assign activity. Create a string variable called “Str_Sample” and then insert the following:
Str_Sample = (Your sample text)
Step 3: Insert ‘Matches’ Activity
Step 4: Update properties for ‘Matches’ Activity
Under Input: insert ‘Str_Sample’
Pattern: Insert this pattern “(Fail)\n(Failed in Course \d+)”
Result: Create new variable (using ‘ctrl + k’) and name the variable MatchesResult
Step 5: Insert Write line activity.
Type in the write line activity the following: MatchesResult(0).Groups(1).tostring + " " + MatchesResult(0).Groups(2).tostring