FIlter list of strings by regex extracting the matches
Created: 2010-10-29 14:02:47
The workflow examines the five element list split from the first service. For each element, if it contains an 'a' followed by two characters, then that triple is included in the output. Thus, for the input ['a','b','abcde','cdef','axy'], only 'abcde' and 'axy' contain a match and so ['abc', 'axy'] is output.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (4)
FIlter list of strings by regex extracting the matches |
FIlter list of strings by regex extracting the specified group in the matches |
FIlter list of strings by regex extracting the specified group in the matches |
FIlter list of strings by regex extracting the specified group in the matches |
Descriptions (1)
The workflow examines the five element list split from the first service. For each element, if it contains an 'a' followed by two characters, then that triple is included in the output. Thus, for the input ['a','b','abcde','cdef','axy'], only 'abcde' and 'axy' contain a match and so ['abc', 'axy'] is output. |
Dependencies (0)
Processors (5)
Name |
Type |
Description |
Split_string_into_string_list_by_regular_expression |
localworker |
ScriptList split = new ArrayList();
if (!string.equals("")) {
String regexString = ",";
if (regex != void) {
regexString = regex;
}
String[] result = string.split(regexString);
for (int i = 0; i < result.length; i++) {
split.add(result[i]);
}
}
|
Filter_list_of_strings_extracting_match_to_a_regex |
localworker |
Scriptimport java.util.regex.*;
filteredlist = new ArrayList();
Pattern thePat = Pattern.compile(regex);
int theGroup = Integer.parseInt(group);
for (Iterator i = stringlist.iterator(); i.hasNext();) {
String item = (String) i.next();
Matcher matcher = thePat.matcher(item);
if (matcher.find()) {
filteredlist.add(matcher.group(theGroup));
}
}
|
string_list |
stringconstant |
Valuea,b,abcde,cdef,axy |
group_description |
stringconstant |
Valuea(.(.)) |
zero |
stringconstant |
Value0 |
Outputs (1)
Name |
Description |
filtered_list |
|
Datalinks (5)
Source |
Sink |
string_list:value |
Split_string_into_string_list_by_regular_expression:string |
zero:value |
Filter_list_of_strings_extracting_match_to_a_regex:group |
group_description:value |
Filter_list_of_strings_extracting_match_to_a_regex:regex |
Split_string_into_string_list_by_regular_expression:split |
Filter_list_of_strings_extracting_match_to_a_regex:stringlist |
Filter_list_of_strings_extracting_match_to_a_regex:filteredlist |
filtered_list |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (0)
(People/Groups)
None
Attributions (0)
(Workflows/Files)
None
Shared with Groups (1)
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment