Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
need to extract the string from this ["IBM"], have to get IBM, I have tried like this
(/['"]/g,'') way. var extractor=(/['"]/g,''); var newArr = extractor.exec(NAME); alert(newArr);
You should parse that as JSON:
var array = JSON.parse(input); alert(array[0]);
Add a comment
This should get you an array of all the matches
var matches = mystring.match(/\[\"(.*?)\"\]/g);
Try this :
//variable contains ["IBM"] variable = variable.substr(2,3);
This will work only if the text between the [""] length is 3
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.