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

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -