Question: This is my input strings

```
1. Mon,Tue,Wed from 10AM to 12PM
2. Mon from 10AM to 12PM
3. Mon, Tue, Wed, Thu from 10AM to 12PM

```

I want my groups to be

```
1. ["Mon,Tue,Wed", "10AM","12pm"]
2. ["Mon", "10AM", "12PM"]
3. ["Mon, Tue, Wed, Thu", "10AM", "12PM"]

```

Here the first groups comes with the 3 lettered week days separated by comma,
I am not understanding cleary how to find the RegEx for finding the first group in it.

I tried:

```
(^((mon|tue|wed|thu|fri|sat|sun|mo|tu|we|th|fr|sa|su|m|w|f),?){1,} # Weekday
\s*[from]*\s* # Seperator
(\d{1,2}(?:[:]\d{1,2})?)\s*([ap][.]?m.?) # Start hour
\s*[-,(to)]+\s* # Seperator
(\d{1,2}(?:[:]\d{1,2})?)\s*([ap][.]?m.?)) # Close hour

```

Answer: 
Finally, I got the answer: Stack Overflow question *[An ASP.NET button click event is not firing](https://stackoverflow.com/a/7673768/1584140)*. Thanks to PirateKitten.

All I needed to do was just to add the following just below my dialog creation in JavaScript, and it worked like charm.

```
$("#editEventModal").parent().appendTo(jQuery("form:first"));

```
You may also add a css modification to be sure that the dialog wouldn't stay behind the overlay div. 

```
$("#editEventModal").parent().appendTo(jQuery("form:first")).css({"z-index":"101"});

```