Question: I am trying to identify lines in a file that have either 4 integer or 2 double values. My regular expression is as below:

```
 var match = new Regex(@"^(?<Values>(((\d+\s*){4})|(\d+\.\d+\s*){2}))$");

```

Sample of lines in the file getting parsed:

```
element 1 2
8 24 2 1 1
0 1 129
2 2 0 0 
30.200001 1000.0000
208 0 0 0 0 0 0 0 
.....
.....

```

Here, my regular expression matches correctly for above lines no 4 & 5. That's ok. But, it's also matching line no 3 (0 1 129). That's the problem for me. **Kindly suggest:** 

1. Why my regular expression is matching line no 3.
2. Correct regular expression that matches exactly either 4 no. of integers or 2 no. of double values in a line.

Answer: 
you directly store result into array. so your code should be like

```
$reader= \Excel::load(Input::file('import_file'))->toArray();
        return redirect()->back()->with('reader', $reader);

```
You can try this:

```
Excel::load(Input::file('import_file'), function ($reader) {
    //Read and get excel rows...
    var $arrExcelData = array();
    $arrExcelData = $reader->toArray();
    return redirect()->back()->with('arrExcelData', $arrExcelData);
});

```

**Render data:**

```
@if(!empty(Session::get('arrExcelData')))
    @foreach(session()->get('arrExcelData')  as $key=>$row)
        print_r($row);
    @endforeach
@endif

```