OO-Designer: cs-base-cp: Improve operation "filter_line"

Idea ID 2758871

OO-Designer: cs-base-cp: Improve operation "filter_line"

I wrote a custom Python operation that enable me to use an custom delimiter and handle multiple regex groups. Maybe it is an idea to make a new operation in cs base content pack or improve the old operation?

Just an idea.

inputs:

text

regex

delimiter

 

here is my code:

import re
return_code = '0'
return_result = ''
error_message = ''

try:

reg = re.compile(regex)
finds = reg.findall(text)

for element in finds:
joinelement = ''.join(element)
return_result += joinelement + delimiter if element != finds[-1] else joinelement

except Exception as e:
return_code = '-1'
error_message = 'Exception: ' + str(e)

2 Comments
Micro Focus Expert
Micro Focus Expert
Status changed to: Waiting for Votes
 
Micro Focus Expert
Micro Focus Expert

Thank you for sharing @RobertBuerger ! We'll keep this in Waiting for Votes to get a bit of feedback from other customers on this enhancement.

Please also note part of the CloudSlang content is open source so you can always contribute by creating pull requests on the public GitHub.

For instance the filter_line operation is available here:

https://github.com/CloudSlang/cs-content/tree/master/content/io/cloudslang/base/strings

Thank you,

Lucian

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.