regex - Extract "Red" "Blue" "Circle" "Black" from "RedBlueCircleBlack" using capital as delimiter? -


is regex problem?

to note: there 4 items, each starts capital letter, each in order (color,color,shape,color): "blackwhitetrianglegreen" etc.

so,

    a="blackwhitetrianglegreen"   

yields:

    c1 = "black"       c2 = "white"       s = "triangle"       c3 = "green" 

edit: referencing post suggested alex k., as3 solution follows works:

    private function uppercasearray(input:string):void {         var result:string = input.replace(/([a-z]+)/g, ",$1").replace(/^,/, "");         var b:array=result.split(",");         c1 = b[0];         c2 = b[1];         s = b[2];         c3 = b[3];     } 

referencing post suggested alex k., as3 solution follows works:

private function uppercasearray(input:string):void {       var result:string = input.replace(/([a-z]+)/g, ",$1").replace(/^,/, "");     var b:array=result.split(",");     c1 = b[0];     c2 = b[1];     s = b[2];     c3 = b[3]; } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -