for regexp gurus...

matteopennese's icon

Hi regexp gurus,
is there a simpler/clever way to do that (only one regexp object)?

Maybe I'll improve my regexp knowledge...

many thanks

Matteo

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

This [regexp] looks for the word "fader" followed immediately by an integer, then a space and finally another number which could be a float or int. It remembers the numbers as backreferences and outputs them as a list. If you want a step by step of what each character is doing then just ask.

lh

Max Patch
Copy patch and select New From Clipboard in Max.

Andrew Pask's icon

Or you could do it the easy way

Max Patch
Copy patch and select New From Clipboard in Max.

-A

matteopennese's icon

Many thanks LH and Andrew!
Just another little question about regexp:
is there an expression to substitute 'fader' with whatever word, so that regexp finds only a symbol ('fader', 'slider', 'bing', etc.)?*

Matteo

* for that purpose I was thinking about regexp rather than route.

matteopennese's icon

It seems I found solution by myself... but always open to suggestions
Many thanks again

matteo

Max Patch
Copy patch and select New From Clipboard in Max.

matteopennese's icon

Sorry to bother you again, but I don't understand the correct syntax in the example below

many thanks

matteo

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

The regexp that doesn't work for you will match a /slash/ followed by any positive integer followed by a space followed by any positive number. However the string you are entering doesn't match this format, it has "/MP" in the middle which the regex can't match. You might find it easier downloading [OSC-route] from the CNMAT website instead of writing your own regexps.

lh

matteopennese's icon

many thanks, now regexp is much clearer.

Matteo