fork(1) download
  1. import re
  2. p = re.compile(r'\[(\d+)\|([^][]*)]')
  3. test_str = "Text [123|Foo bar] text"
  4. print (p.findall(test_str))
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
[('123', 'Foo bar')]