<p>I am trying to insert a new row into my table which holds the same data as the one I am trying to select from the same table but with a different <code>user_id</code> and without a fixed value for <code>auto_id</code> since that is an auto_increment field, and setting <code>ti</code> to NOW(). Below is my mockup query where '1' is the new <code>user_id</code>. I have been trying many variations but am still stuck, anyone who can help me with turning this into a working query. </p>

<pre><code>INSERT INTO `lins` ( `user_id` , `ad` , `ke` , `se` , `la` , `ra` , `ty` , `en` , `si` , `mo` , `ti` , `de` , `re` , `ti` ) (

SELECT '1', `ad` , `ke` , `se` , `la` , `ra` , `ty` , `en` , `si` , `mo` , `ti` , `de` , `re` , NOW( )
FROM `lins`
WHERE autoid = '4'
AND user_id = '2'
)
</code></pre>

<p>Thank you for taking the time to help me out!</p>

I think you need to explicitly match the line terminators, as well as handle spaces better as others have suggested.  Assuming the user can choose between \r and \n, try
```
```
@"(?<select>\Aselect .+)[\n\r]" +
@"(?<from>\s*from .+)[\n\r]" +
@"(?<where>\s*where .+)[\n\r]" +
@"(?<groupBy>\s*group by .+)[\n\r]" +
@"(?<having>\s*having .+)[\n\r]"
```
```
As long as you are using regular expressions, you probably want to do a bit better:
```
```
@"\Aselect (?<select>.+)[\n\r]" +
@"\s*from (?<from>.+)[\n\r]" +
@"\s*where (?<where>.+)[\n\r]" +
@"\s*group by (?<groupBy>.+)[\n\r]" +
@"\s*having (?<having>.+)[\n\r]"
```
```
My biggest problem with regular expressions for this sort of use is that the only error message you can give is that things failed.  You can't give the user any further information about what they did wrong.