Sunday, 15 January 2012

javascript - Search a string -



javascript - Search a string -

i have form user fill tags this:

<messagecode>tag value 1</messagecode> <messageversion>tag value 2</messageversion>

and know if there way in javascript search next strings:

string 1 = <messsagecode> string 2 = tag value 1?

i should utilize index of?

if insist on parsing xml regexps , string functions, then

input.match(/<(.*?)>(.*)<\/\1>/)

will homecoming array, [1] element tagname , [2] element content.

instead, should utilize domparser reliably parse input, , utilize dom functions navigate result.

javascript indexof

No comments:

Post a Comment