fork download
  1. import re
  2.  
  3. string = '{http://w...content-available-to-author-only...g.org/PMML-4_3}TreeModel/{http://w...content-available-to-author-only...g.org/PMML-4_3}Node/Node[1]/Node[4]/Node[1]'
  4. matches = re.findall(r'/?(?:{[^{}]*})?[^/]+', string)
  5.  
  6. array = []
  7. output = ''
  8.  
  9. for i in range(len(matches)):
  10. output += matches[i];
  11. array.append(output)
  12.  
  13. print(array)
Success #stdin #stdout 0.04s 9588KB
stdin
Standard input is empty
stdout
['{http://w...content-available-to-author-only...g.org/PMML-4_3}TreeModel', '{http://w...content-available-to-author-only...g.org/PMML-4_3}TreeModel/{http://w...content-available-to-author-only...g.org/PMML-4_3}Node', '{http://w...content-available-to-author-only...g.org/PMML-4_3}TreeModel/{http://w...content-available-to-author-only...g.org/PMML-4_3}Node/Node[1]', '{http://w...content-available-to-author-only...g.org/PMML-4_3}TreeModel/{http://w...content-available-to-author-only...g.org/PMML-4_3}Node/Node[1]/Node[4]', '{http://w...content-available-to-author-only...g.org/PMML-4_3}TreeModel/{http://w...content-available-to-author-only...g.org/PMML-4_3}Node/Node[1]/Node[4]/Node[1]']