I am trying to extract a substring between two set of patterns using re.search()
.
On the left, there can be either 0x
or 0X
, and on the right there can be either U
, , or \n
. The result should not contain boundary patterns. For example, 0x1234U
should result in 1234
.
I tried with the following search pattern: (0x|0X)(.*)(U| |\n)
, but it includes the left and right patterns in the result.
What would be the correct search pattern?
Aucun commentaire:
Enregistrer un commentaire