0

I need extrack onclick value. I tried so much method but I can't complete it. I am working on an application and I am new regular expression.

<button class='btn btn-orange' type='button' onclick='addToCart(139133735, 730, 199100)'>Add to Cart</button>

I wanna extract addToCart(139133735, 730, 199100) OR 139133735, 730, 199100

Can you help me please?

Mary
  • 11
  • 2
    Regex is not best tool for this task (mandatory link: https://stackoverflow.com/a/1732454). Instead use proper HTML or XML parser like jsoup where your code can look like: `Jsoup.parse(yourHtml).select("button.btn.btn-orange").attr("onclick")` – Pshemo Jun 05 '17 at 21:08
  • 1
    ty @Pshemo it worked – Mary Jun 05 '17 at 21:29

0 Answers0