Q:

Wait for volley response, then update ListView

I want to data out of the mediawiki api, parse it, then put headings and paragraphs into a listview. In the code below, I create and set the adapter inside the onResponse method of the request, because if I do that outside, the request will not have finished yet. 
I also override the getView method of the adapter because I want to format the items, e.g. bold and coloured headings. I tested this in another project and it works, but when put inside the onResponse method, this section no longer has any effect.
The solution I have in mind would be waiting for volley to complete the request before setting the listview on the main thread. I've read solutions about using futures and an asynctask, but it didn't work for me and I don't really understand it enough to try and fix it. Can anyone help? 
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final ListView listView = findViewById(R.id.listView);
        RequestQueue queue = Volley.newRequestQueue(this);
        String url = "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&titles=OSI%20model&exlimit=1";
        StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        Pattern pattern = Pattern.compile("<p>(.*?)</p>|<ul>(?!<li>Mi)(.*?)</ul>|<span id=\\\\\"((?!Examples|Comparison_with_TCP.2FIP_model|See_also|References|External_links).*?)\\\\\">");
                        Matcher matcher = pattern.matcher(response);
                        ArrayList<String> content = new ArrayList<>();
                        content.add("OSI Model");
                        while (matcher.find()){
                            String s = matcher.group();
                            s = s.replaceAll("</li>\\\\n<li>", "\n");
                            s = s.replaceAll("<p>|</p>|<b>|</b>|<i>|</i>|<ul>|</ul>|<li>|</li>|\\\\\">", "");
                            s = s.replaceAll("\\\\u00e9", "e");
                            s = s.replaceAll("\\\\u2013|\\\\u2014", " - ");
                            s = s.replaceAll("_|\\\\n", " ");
                            s = s.replaceAll("\\\\\"", "\"");
                            content.add(s);
                        }
                        ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_list_item_1,content){
                            @Override
                            public View getView(int position, View convertView, ViewGroup parent){
                                TextView item = (TextView) super.getView(position,convertView,parent);
                                String itemText = super.getItem(position);
                                if (itemText.matches("<span id=\\\\\".+")){
                                    System.out.println("A");
                                    item.setTextColor(Color.parseColor("#FF9933"));
                                    item.setTypeface(item.getTypeface(), Typeface.BOLD_ITALIC);
                                    item.setTextSize(TypedValue.COMPLEX_UNIT_DIP,20);
                                    item.setText(itemText.replaceAll("<span id=\\\\\"", ""));
                                }
                                return item;
                            }
                        };
                        listView.setAdapter(arrayAdapter);
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {}
        });
        queue.add(stringRequest);
    }
}

A:

You are missing this in your manifest.xml
<uses-permission android:name="android.permission.INTERNET"/>

Your regex is wrong, I recommend you to use this regex-tool to see what you are doing wrong.
I made a changes in your regex and I see something like this : 

What I've changed is this :
 if (itemText.matches("<span id=\".+")){

But if you leave it like this you'll get problems when scrolling, so you have to do a tricky stuff. Modify it as your like
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_list_item_1,content){
                                @Override
                                public View getView(int position, View convertView, ViewGroup parent){
                                    TextView item = (TextView) super.getView(position,convertView,parent);
                                    String itemText = super.getItem(position);
                                    if (itemText.matches("<span id=\".+")){
                                        item.setTextColor(Color.parseColor("#FF9933"));
                                        item.setTypeface(item.getTypeface(), Typeface.BOLD_ITALIC);
                                        item.setTextSize(TypedValue.COMPLEX_UNIT_DIP,20);
                                        item.setText(itemText.replaceAll("<span id=\\\\\"", ""));
                                    }
                                    else{
                                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                                            item.setTextColor(getColor(android.R.color.primary_text_light));
                                        }
                                        item.setTypeface(null,Typeface.NORMAL);
                                        item.setTextSize(14);
                                        item.setText(itemText.replaceAll("<span id=\\\\\"", ""));

                                    }
                                    return item;
                                }

