Code Block working with List

For Dynamo specific workflows with Python have a look around the forum.

For more general code introduction take a look at something like the Harvard CS50 videos online. :wink:

When working with Strings (Text Values) you can use Regular Expressions to ‘sense’ their structure.

import re

input_list = IN[0]  # List of strings
result = []  # Output

for item in input_list:
    # Use regular expression to find the pattern of sequential numbers or letters after the initial 'C'
    match = re.search(r'C[A-Za-z0-9]+', item)
    if match:
        result.append(match.group())

OUT = result

1 Like