[SOLVED] RegEx and the match() function
in
Programming Questions
•
4 months ago
Hi everybody,
i'm having a trouble here with my regEx experiment.
In my program i have several button that are doing closely the same thing and they are named P1, P2, ... P5
So i thought instead of writting a specific controlEvent for each one i tried this :
void controlEvent(ControlEvent event){
String[] mp = match(event.controller().name(), "P"[1-5]);
if (mp != NULL )
{
//code
}
}
i'm having this error on the second line (String[] mp = match etc etc) :
The type of the expression must be an array type but it resolved to String.
And i can't figure out why, i believe i'm in line with the given examples in the Processing reference :
String[] = match( str, regexp)
Thanks for reading
i'm having a trouble here with my regEx experiment.
In my program i have several button that are doing closely the same thing and they are named P1, P2, ... P5
So i thought instead of writting a specific controlEvent for each one i tried this :
void controlEvent(ControlEvent event){
String[] mp = match(event.controller().name(), "P"[1-5]);
if (mp != NULL )
{
//code
}
}
i'm having this error on the second line (String[] mp = match etc etc) :
The type of the expression must be an array type but it resolved to String.
And i can't figure out why, i believe i'm in line with the given examples in the Processing reference :
String[] = match( str, regexp)
Thanks for reading
1