-4

I have the following string

x = "[['Glass Battery Hydrometer'], ['RS Stock No.', '196-8187'], ['Mfr. Part No.'], ['Brand', 'RS Pro'], ['Compare']]"

How to use regular expression in python to extract "['RS Stock No.', '196-8187']" this particular portion from the string

Also once that particular string is extracted I need to extract '196-8187' this value from it.

Saravanan
  • 132
  • 2
  • 10
  • `re.findall(...)[1]` – cs95 Sep 13 '17 at 07:20
  • Regex is about matching patterns. You haven't described the pattern you want to match. Do you see the problem with this? You have to tell us _why_ `['RS Stock No.', '196-8187']` should be extracted or we can't help you. – Aran-Fey Sep 13 '17 at 07:20
  • I have a column consisting of similar strings. I want to form a new column consisting of 'RS Stock no' alone – Saravanan Sep 13 '17 at 07:25

1 Answers1

0

About so:

^\[\[.*\]\, \[('.*','(.*)')\].*$
Martin B.
  • 1,567
  • 14
  • 26