Question: Good Morning DBA's, 
I need a function to pulls an int DocumentID column and returns the lowest thousand int. The limitation is our result must have 8 chars and the leading characters need to be 0's. 

* **Example 1**: 1234 (int contained in DocumentID column) Result: 00001000
(generated by function in result set)
* **Example 2**: 1152534 Result: 01152000

Result Set...

```
DocumentID Function 

1234       00001000 
1152534    01152000

```

Answer: 
```
var a = "Message:_27265. Task:U_AW_GEN_M";
var msg = a.split(":")[1].split(".")[0];
var task = a.split(":")[2];

console.log(msg+"---"+task);

```
One solution is to use the `split()` method of javascript. This can be done without using jQuery, but since you have tagged the question with jQuery, I have used it within my solution.

You did not specify where the text would be coming from. So I assumed that it would be within a webpage body. Of course you can change body to whatever the container is that holds the text.

```
var text = $("body").html().split('.');
var message = text[1].split(':')[1];
var task = text[2].split(':')[1];

```

Demo here: <http://jsfiddle.net/teuWY/1/>

Edited code to reflect efficiencies of other solutions.