public static void main(String[] args) {
String mHtmlCode = "";
try{
Scanner in = new Scanner(new FileReader("page.txt"));
StringBuilder sb = new StringBuilder();
while(in.hasNext()) {
sb.append(in.next());
}
in.close();
mHtmlCode = sb.toString();
}catch(Exception ex){System.out.println(ex.getMessage());}
//System.out.println(mHtmlCode);
String mapZoom = "";
Pattern pMapZoom = Pattern.compile("data-token=\"(.*?)\"\\n\\s+data-ad-id=\"(.*?)\">");
Matcher mMapZoom = pMapZoom.matcher(mHtmlCode);
//Log.d(TAG, "HTML: " + mHtmlCode);
int i=0;
while(mMapZoom.find()) {
if(mMapZoom.group(1).length()>0) {
//Log.d(TAG, "data[map_zoom]=: " + mMapZoom.group(1));
System.out.println("token=: " + mMapZoom.group(1));
mapZoom = mMapZoom.group(1);
break;
}
i++;
}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".AddNewAdActivity">
<EditText
android:id="@+id/etAdTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="Заголовок"
android:inputType="textPersonName"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="8dp" />
<Spinner
android:id="@+id/spCategoriesLv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/etAdTitle"
tools:layout_editor_absoluteX="39dp" />
<Spinner
android:id="@+id/spCategoriesLv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/spCategoriesLv1"
tools:layout_editor_absoluteX="16dp" />
<Spinner
android:id="@+id/spCategoriesLv3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/spCategoriesLv2"
tools:layout_editor_absoluteX="16dp" />
<EditText
android:id="@+id/etAdDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="Описание"
android:inputType="textPersonName"
app:layout_constraintTop_toBottomOf="@+id/containerForSettingFromFragments"
tools:layout_editor_absoluteX="16dp" />
<GridView
android:id="@+id/gvPhotos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:numColumns="auto_fit"
android:columnWidth="100dp"
app:layout_constraintTop_toBottomOf="@+id/etAdDescription"
/>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:onClick="btnSaveAd"
android:text="Button"
app:layout_constraintTop_toBottomOf="@+id/etSellerName"
tools:layout_editor_absoluteX="345dp" />
<FrameLayout
android:id="@+id/containerForSettingFromFragments"
android:layout_width="368dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/spCategoriesLv3"
tools:layout_editor_absoluteX="8dp">
</FrameLayout>
<EditText
android:id="@+id/etPhoneNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="Номер телефона"
android:inputType="textPersonName"
app:layout_constraintTop_toBottomOf="@+id/etSelectCity"
tools:layout_editor_absoluteX="101dp" />
<EditText
android:id="@+id/etSellerName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="Контактное лицо"
android:inputType="textPersonName"
app:layout_constraintTop_toBottomOf="@+id/etPhoneNumber"
tools:layout_editor_absoluteX="275dp" />
<EditText
android:id="@+id/etSelectCity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:ems="10"
android:inputType="textPersonName"
android:text="Name"
app:layout_constraintTop_toBottomOf="@+id/gvPhotos"
tools:layout_editor_absoluteX="101dp" />
</android.support.constraint.ConstraintLayout>