Here's a generic parser. I should probably check to see how slowly this runs, and it may be overkill, but for now...

Code:
Global_Variable Integer ghFilter

Function FilterArray Global Variant[] aVariant Integer hObj Integer iMsg Returns Variant[] 
    Variant[] aReturn 
    Integer iPos 
    Integer iCopied 
    Integer iMax 
    Boolean isOK 
    
    Move (SizeOfArray(aVariant)) to iMax 
    For iPos from 0 to (iMax-1) 
        Get iMsg of hObj aVariant[iPos] to isOK 
        If (isOK) Begin 
            Move aVariant[iPos] to aVariant[iCopied]
            Move (iCopied+1) to iCopied 
        End
    Loop
    Move (ResizeArray(aVariant,iCopied)) to aVariant
    Function_Return aVariant
End_Function

Function FilterString Global String sInp Integer hMsg Returns String 
    UChar[] aFixed
            
    Move (StringToUCharArray(sInp)) to aFixed 
    Get FilterArray aFixed ghFilter hMsg to aFixed 
    Move (UCharArrayToString(aFixed)) to sInp 

    Function_Return sInp 
End_Function

Object oStringFilter is a cObject 
    
    Function IntegerFilter UChar iChar Returns Boolean
        If (iChar>57) Function_Return False  
        If (iChar<48) Function_Return False  
        Function_Return True 
    End_Function
    
    Move (Self) to ghFilter
End_Object
It can go in its own package, and you can add new filter functions to the oStringFilter object (Only Ascii, Only AlphaNumeric, valid filenames, etc) as you need them.
To strip out all characters from a string, except [0..9], use

Code:
Get FilterString "ewnfhweh1234erfkeropg" (RefFunc(IntegerFilter)) to sInp