-1

Let's say I have the following string:

 Test_string = "6|Oxidation@9|Carbamidomethylation@10|20H"

I want to have Oxidation, Carbamidomethylation and 20H in a list.

I have tryed the following:

test_list = re.findall(pattern="[\|][\da-zA-Z]+", string=test_string)

But this includes the |, which I don't need. I also tryed excluding the "[|]". But this also results into the numbers being present in the list.

Fred
  • 16
  • 3
  • This is a well-known issue. Use either `re.findall(r"(?<=\|)[\da-zA-Z]+", test_string)` or `re.findall(r"\|([\da-zA-Z]+)", test_string)`. See [this Python demo](https://ideone.com/Y9XyUK). – Wiktor Stribiżew Aug 25 '23 at 08:59

0 Answers0