-1

How can I detect this part: /table/LEKPOOZZZCV/LSK1633923 from string variable:

'<a class="live-data__header" href="/table/LEKPOOZZZCV/LSK1633923"><div class="table_names" data-v-fc63c1b6=""><span class="table_names__name" data-v-fc63c1b6="" title="W............

using regex expression?

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
314mip
  • 383
  • 1
  • 4
  • 13

1 Answers1

0

You can use findall such as

import re
s = '<a class="live-data__header" href="/table/LEKPOOZZZCV/LSK1633923"><div class=....'
print(re.findall('href="([^"]*)"', s))

in order to get as a list or

l = re.findall('href="([^"]*)"', s)
for i in l:
    print(i)

to get as a string

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55