I'm trying to figure out why I can't get the pattern matching and especially the "wildcards" to work properly.
FWIW, I'm on a RPI Pico W w/ Earle Philower Arduino Pico, Arduino core for RP2040.
I've tried with .match, .route and .dispatch I can only traverse hardcoded addresses like the following ones:
msg.match("/er301/*);
Note that the * does work. Something like the pattern below will work:
if (msg.match("/*/hello/*/world")) {
OSC_debug(msg);
}
But absolutely no chance with { } and [ ] and that's my issue here.
I can't traverse the following pattern for example:
msg.route("/{er301,txo}/[1-4]/fct/*", OscDebug);
This full simplified example won't work either ; when sending /er301/42 or /txo/42 from Max, I can't match any message and reach my OscDebug callback function :
void loop() {
OSCMessage msg;
int size = Udp.parsePacket();
if (size > 0) {
while (size--) {
msg.fill(Udp.read());
}
if (!msg.hasError()) {
if (msg.match("/{er301,txo}/*")) {
OSC_debug(msg);
}
} else {
error = msg.getError();
Serial.print("error: ");
Serial.println(error);
}
}
}
Am I missing something ? I used quite complex pattern-matching with another OSC library, unfortunately it's not flexible enough and I'd rather use the CNMAT library. If I can't get the pattern matching function working, I guess I could always match "step by step" each element of the address...
Hi,
I'm trying to figure out why I can't get the pattern matching and especially the "wildcards" to work properly. FWIW, I'm on a RPI Pico W w/ Earle Philower Arduino Pico, Arduino core for RP2040.
I've tried with
.match
,.route
and.dispatch
I can only traverse hardcoded addresses like the following ones:msg.match("/er301/*);
Note that the * does work. Something like the pattern below will work:
But absolutely no chance with { } and [ ] and that's my issue here.
I can't traverse the following pattern for example:
msg.route("/{er301,txo}/[1-4]/fct/*", OscDebug);
This full simplified example won't work either ; when sending
/er301/42
or/txo/42
from Max, I can't match any message and reach myOscDebug
callback function :Am I missing something ? I used quite complex pattern-matching with another OSC library, unfortunately it's not flexible enough and I'd rather use the CNMAT library. If I can't get the pattern matching function working, I guess I could always match "step by step" each element of the address...
Any help appreciated, thanks! :-)