Ronaldo Killergod Ronaldo Killergod - 2 months ago 5
Javascript Question

Best way of extracting substring from a string by regex - javascript (string value below)

var stringname="function func() {alert('testing savecallback2');}"

This is the string value I was having hard time extracting.
I want to extract "func()" or any name that appends with "()".

Please help me up.


you want like this?

var arr = "function func() {alert('testing savecallback2');}".match(/\s([A-Za-z0-9]+\(\))\s/);