Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    @Nullable
    static String extractClientSecretFromHtml(@NonNull String html) {
        // quotes around attribute values are optional in HTML5: http://stackoverflow.com/q/6495310/504611
        Pattern clientSecretPattern = Pattern.compile(
                "^.*<meta[ ]+name=['\"]?env-clientSecret['\"]?[ ]+content=['\"]?([^'\"]+)['\"]?.*$",
                Pattern.DOTALL);
        Matcher matcher = clientSecretPattern.matcher(html);
        String clientSecret = null;
        if (matcher.matches()) {
            clientSecret = matcher.group(1);
        }
        return clientSecret;
    }
}