javascript - How would I get a certain part of a string? -


here's example string:

survey_questions_attributes_1317784471568_answers_attributes 

i want 1317784471568 out of string.

but part text. example, may need string called new_questions same spot in string.

the constant here survey_questions_attributes_ precede chunk want , _answers_attributes follow it.

id = str.match(/_questions_attributes_(.+)_answers_attributes/)[1]; 

Comments

Popular posts from this blog

Python __call__ special method practical example -

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -