Question: I am using material-ui for my project and I have a need to get the selected text (not the value) and do some parsing. I can't seem to find a way to do this.

Here is what my component looks like:

```
                    <TextField
                        select
                        margin="dense"
                        label="Name"
                        variant="outlined"
                        className={classes.textField}
                        value={values.nameId}
                        onChange={handleChange('nameId')}
                    >
                        {names.map(row => (
                            <MenuItem key={row.Id} value={row.Id}>{row.Name}</MenuItem>
                        ))}
                    </TextField>

```

handler looks like this:

```
const handleChange = name => event => {

    setValues({ ...values, [name]: event.target.value });
};

```

Obviously event.target.value gets my selected value, but I want to also get the selected innerText of the selected index. Any ideas?

Answer: 
This regex match should get you what you're looking for

```js
let regex = /1-[0-9]{3}-[0-9]{3}-[0-9]{4}/ 

```
Try

```
let candidateValue = getMeSomeValue();

const isValid = (candidateValue || "").match( /^1-[0-9]{3}-[0-9]{4}$/ );

```

Add `\s` following the `^` and before the `$` if you want to play nice and ignore leading/trailing whitespace.