Question: My xml code is :

```
<Spinner
    android:id="@+id/destination"
    android:layout_width="344dp"
    android:layout_height="30dp"
    android:autofillHints="Choose destination"
    android:spinnerMode="dropdown" />

```

I want to add hint (without using dummy entry) as to be shown to user when the activity starts.
The inbuilt xml hint feature is not working after using FireBase.

MainActivity :

```
myRef.child("Stations").addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            final List<String> stationname = new ArrayList<String>();

            for (DataSnapshot stationSnapshot : dataSnapshot.getChildren()) {

                 String stationName = stationSnapshot.child("Name").getValue(String.class);
                 stationname.add(stationName);
            }

            Spinner sp2= findViewById(R.id.destination);

            ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(FairPage.this, android.R.layout.simple_spinner_item, stationname);
            arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

            sp2.setAdapter(arrayAdapter);

```

Answer: 
Are you sure you need a regex ?
Something like this can calculate the ratio in a row :

```
>>> a = list('abce')
>>> b = list('abcd')
( 100 - (sum(i != j for i, j in zip(key, 'air')) / float(len(a))) * 100 )
75.0

```

But if `b = list('bdce')` it will just be 50%
You may use this alternation based approach:

```
>>> key = 'rain'
>>> l_word = int(len(key) *3 /4)

>>> my_regex = re.compile(r'^' + key[0:l_word] + '|' + key[-l_word:] + '$')

>>> print (my_regex.pattern)
^rai|ain$

>>> print bool(my_regex.search('air'))
False
>>> print bool(my_regex.search('12Qain'))
True
>>> print bool(my_regex.search('raisin'))
True

```

Regex `^rai|ain$` either matches 75% characters of given keyword at the start or at the end.