0

In python I can't match all character including newline. This is the string

<ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
  4tzL1OLLe3eEchFIDFFJbA==</ebl:NotificationSignature>

This is the regex I've used

re.findall('<ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents>"(.*?)</ebl:NotificationSignature>', body)

I tried with this one:

    re.findall('<ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents>"(.*?|\n*)</ebl:NotificationSignature>', body)

They return nothing. I am using python 2.7.

Wiktor Stribiżew
  • 484,719
  • 26
  • 302
  • 397
blob
  • 279
  • 4
  • 12
  • The first regex is fine, just use `re.DOTALL` or `re.S` as `flags` argument. However, an XML parser based solution would be more appropriate since you have XML. – Wiktor Stribiżew Nov 13 '19 at 15:25
  • @WiktorStribiżew I think the real issue is that the regex has `eBLBaseComponents>"` instead of `eBLBaseComponents">` (note that the positions of the `"` and `>` characters are swapped from their positions in the original string) – Donut Nov 13 '19 at 15:26
  • @Donut That is a typo, the real issue is stated at the top: *In python I can't match all character including newline.* – Wiktor Stribiżew Nov 13 '19 at 15:28
  • I had problem with namespace using xpath from lxml. I only need few tags. – blob Nov 13 '19 at 15:30

0 Answers0