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:
- the string tested.
- the first element within
<! !> - 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
Post a Comment