jQuery/JavaScript regex return matched text from string -


i trying create complex system website. want able write pseudo code , parse make in back-end.

my data inside 2 $.each loops object of data multiple levels it.

for instance, want take string this:

"<!this!> == <!propertystreetnumber!>" 

then how above code executed this:

formdata[parentkey][this] == formdata[parentkey]["propertystreetnumber"] 

thanks help!

here's of code, code need go in (see commented area) http://jsbin.com/liquvetapibu/1/

is there restriction not use regular expressions on javascript?

you this:

var mystring = "<!this!> == <!propertystreetnumber!>"; var aux = /<!(.*?)!> == <!(.*?)!>/.exec(mystring); 

the value of aux array 3 elements:

  1. the string tested.
  2. the first element within <! !>
  3. the second element within <! !>

then depend on content on each 1 is: in example this object, while seem use propertystreetnumber string (maybe typo?). if want use object, have use eval() (e.g.: eval(aux[1])) while if want use string, can use directly (e.g.: aux[2]).


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -