-2

I have a string like this '0x69313430303239377678(i1400297vx)' I only want the value i1400297vx and nothing else.

Is there a simple way for example using strip method or I'm forced to use Regex,I'm not good at...

Someone could kindly help me?

snuz
  • 185
  • 12
  • 1
    use split("()") ? – billz Dec 28 '20 at 10:04
  • 2
    https://stackoverflow.com/questions/4894069/regular-expression-to-return-text-between-parenthesis – N. Arunoprayoch Dec 28 '20 at 10:04
  • Does this answer your question? [How to extract the substring between two markers?](https://stackoverflow.com/questions/4666973/how-to-extract-the-substring-between-two-markers) – Maritn Ge Dec 28 '20 at 10:04
  • @billz `'0x69313430303239377678(i1400297vx)'.split("()")` returns `['0x69313430303239377678(i1400297vx)']` - this is **not what OP wants**. – AcK Dec 28 '20 at 10:24

1 Answers1

1

This works, using split and strip:

'0x69313430303239377678(i1400297vx)'.split('(')[1].strip(')')

but a regex would be more readable!

Demi-Lune
  • 1,868
  • 2
  • 15
  • 26