I am working on this bit of code that checks a line of actionscript 3 code for the existance of a type (MovieClip, Sprite, along with the custom classes defined in the classpath) that is in a collection that is being iterated.
for (String type: typeList) {
if (input.contains(type)) {
// dome something here
}
}
The problem is, some of the custom type names also contain the name of another type:
Custom type: fSceneController
Contains flash type: Scene
So the .contains method will not work properly. I was thinking of using a regex inside the loop where the pattern checks for the type and makes sure that there are no a-zA-Z0-9 immediately before or after the type.
Pattern p = Pattern.compile("<stuff here>"+ type + "<more stuff here>");
Can anyone help me determine what i should put before and after the type so that the type itself can be detected distinctly from other types that may contain part of the text?
Or perhaps suggest a different method that i can use to accomplish the same goal?