September 28, 2020, 2:01am
I have the data below,
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”
Yes, its possible with Regex
Thanks for the text sample and output. Some more information on the pattern would be helpful when developing a solution
Will the text change?
Is it always on a new line?
Is it always 3 digits?
Hugo_Pang.xaml (4.9 KB)
I have made a sample workflow which will change depending on the course number.
September 28, 2020, 2:46am
Hi Steven, Thank you so much for your reply.
However, I am not able to download the workflow due to the restriction of my work environment. Would it be able to share the step of your workflow?
What I did in the workflow…sure
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
Step 6: Run
Whole of workflow view:
October 1, 2020, 3:05am
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.