Android get data using regexp -
i have html string in in trying string between tag using regexp , saving value array-list . not able string between tag array-list empty.
<span><div style=\'float:left; width:350px;\'>pharmacie dar d\'bagh</div>
my code data using regexp is
private void findtextbyregexp() { arraylist<arraylist<string>>datalist1 = new arraylist<arraylist<string>>(); string pattern3 = "<span><div style=\'float:left; width:350px;\'>"; string pattern4 = "</div>"; string text = readfromfile(); pattern p = pattern.compile(pattern.quote(pattern3) + "(.*?)" + pattern.quote(pattern4)); matcher m = p.matcher(text); while (m.find()) { arraylist<string>dataadd = new arraylist<string>(); dataadd.add(m.group(1)); datalist1.add(dataadd); log.d("group data", "" + m.group(1)); } log.d("my array list od data", "" + datalist1); }
please me how achieve using regexp?
try
string pattern3 = "<span><div style=\\'float:left; width:350px;\\'>";
Comments
Post a Comment