I want to extract these specific substrings from a string. These are a few couple examples below, but ultimately I have many input strings that are similar. I have tried a substring "frameshift" method but the issue is that I get many undesirable output strings ex. ...(((((.....)))))... --> (((((.....))))), ((((.....)))), (((.....))), ((.....)), and (.....) (this is not desirable). As you can see in the patterns below, I need an equal number of open/close parenthesis and no trailing periods in the substrings.
Example 1
Input String: ..(((...(((((.(((.....((.................))..))).))))).)))..
Desired Extracted Output Substring(s): (((...(((((.(((.....((.................))..))).))))).)))
Example 2
Input String: (((((.((.((..............))..)).)))))(((((.....)))))........
Desired Extracted Output Substring(s): (((((.((.((..............))..)).)))))(((((.....))))) AND (((((.((.((..............))..)).))))) AND (((((.....)))))
Example 3
Input String: ........(((((.......................((((((...))))))...))))).
Desired Extracted Output Substring(s): (((((.......................((((((...))))))...)))))
Aucun commentaire:
Enregistrer un commentaire