myVar VAR byte[32] ' Array for inbound serial data
X VAR BYTE ' Holds "S" start position
Y VAR BYTE ' Holds "E" end position
Index VAR BYTE ' Index pointer
B0 VAR WORD
B1 VAR WORD

Begin:
HSERIN [STR myVar\32\13] ' Terminate with CR

Get_Start: ' X will hold the start "S" position
FOR X = 0 TO 31
IF myVar[X] = "S" THEN Get_End
NEXT X
GOTO BEGIN

Get_End: ' Y will hold the end "E" position
FOR Y = X+1 TO 31 ' Find "E"
IF myVar[Y] = "E" THEN Done
NEXT Y
GOTO BEGIN

Done: ' Display start/end positions
HSEROUT ["Start = position ",DEC X,13,10]
HSEROUT ["End = position ", DEC Y,13,10]

Now you can do whatever you need to with the remaining serial data. You know where it starts & ends in the array.

There are many ways to do this. Here's one simple example.

' myVar[X+1] to myVar[Y-1] should be holding valid characters

' Loose_Decimals just subtracts ASCII 0 from each
' ASCII value & returns the decimal result

Loose_Decimals:
FOR Index = X+1 to Y-1 ' Increment X to 1st character
myVar[Index] = (myVar[Index]-"0") ' Convert to decimal
NEXT Index

Sort_B0:
B0 = myVar[X+1] * 100 ' 1st character after "S"
B0 = B0 + myVar[X+2] * 10
B0 = B0 + myVar[X+3]
HSEROUT ["B0 = ",DEC B0,13,10]

Sort_B1:
B1 = myVar[X+4] * 1000 ' 4th character after "S"
B1 = B1 + myVar[X+5] * 100
B1 = B1 + myVar[X+6] * 10
B1 = B1 + myVar[X+7]
HSEROUT ["B1 = ", DEC B1,13,10]
GOTO Begin

END

I sent the following serial data to the PIC with MicroCode Studio's terminal program;

Note: Be sure you have the "parse control characters" button selected in the MicroCode Studio terminal program. This sends the #13 or CR which terminates waiting for the entire 32 byte string, and allows program flow to fall through to your parsing routines.

Hello S1234567E #13

Here's the return data from the PIC;

Start = position 6 ' <-- S position
End = position 14 ' <-- E position
B0 = 123
B1 = 4567

Start position 6 + 1 or array element myVar[7] is your 1st valid character. End position 14 - 1 myVar[13] is your last. 6 holds the S, and 14 holds the E so everything in between 6 to 14 or myVar[7] to myVar[13] is assumed valid data with your paticular scenario.

This should be enough to get you started. If you know the beginning & ending ASCII characters, it's simple to extract whatever data is in between.