android - How to get substring with javascript code from HTML code in Java? -


i parse 1 web page , need min , max values slider elements. page parse jsoup, values can't it.. in javascript blocks.

<script>     $(function(){ $("#p_slider").slider({ range:true, step:1000, min:2000, max:49490.00, values:[2000,49490.00], slide:function(event, ui) {     $("#p_from").val((ui.values[0] != 2000)?ui.values[0]:"");     $("#p_to").val((ui.values[1] != 49490.00)?ui.values[1]:"");     $("#p_from").change();     $("#p_to").change(); } }); }); </script> <script>     $(function() { $("#filter_543_slider").slider({ range:true, step:1000, min:0, max:17600.000, values:[0,17600.000], slide:function(event, ui) {                     $("#f543_from").val((ui.values[0] != 0)?ui.values[0]:"");                     $("#f543_to").val((ui.values[1] != 17600.000)?ui.values[1]:"");                     $("#f543_from").change();                     $("#f543_to").change();                 } }); }); </script> 

i need min , max values #p_slider , #filter_543_slider

now try code:

string min = bodyhtml.split("[$(\"#"+searchingident+"\").slider({]")[1].split("[min:]")[1].split(",")[0]; string max = bodyhtml.split("[$(\"#"+searchingident+"\").slider({]")[1].split("[max:]")[1].split(",")[0]; 

but catch error: err:length=1; index=1

and splitting getting time.. +5-10 seconds

please, tell me how needed substrings correct , fast.

sorry english.

i recomment use regular expressions. wrote 1 here you:

\$\("#([a-z0-9_]+)"\)\.slider\([^\)]+min:([0-9\.]+)[^\)]+max:([0-9\.]+) 

this 1 checks jquery line expects id (or better # sign) , after slider function parameters min , max inside.

try fiddler check result.

the first result id, second 1 min value , third 1 max value.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -