|text to get| Other text.... migh have "|"'s ...
How can I get the text to get stuff from the string (and remove it)?
text to get
It should be just the first match
var test_str = "|text to get| Other text.... migh have "|"'s ..."; var start_pos = test_str.indexOf('|') + 1; var end_pos = test_str.indexOf('|',start_pos); var text_to_get = test_str.substring(start_pos,end_pos) alert(text_to_get);
2.1m questions
2.1m answers
60 comments
56.9k users