Regular Expression Tutorial

A Max/MSP tutorial and reference patch that explains a few of the basic techniques you need to create regular expressions for string parsing and pattern matching using the [regexp] and [jit.str.regexp] objects. It contains working examples of the most important and widely used features of regular expressions so that you can explore and learn from them in the Max environment.

The topics covered include:

  • Character Types

  • Anchors

  • The Dot

  • Alternation

  • Repetition

  • References

regexp_tutorial.maxpat.zip
zip
dolphinazz's icon

I want to extract some part from url address using 'regexp' or other.
for example, from "https://1cyjknyddcx62agyb002-c74projects.s3.amazonaws.com/files/2013/06/icons-200x200-product-m-2.png", I want to extract only "m-2". Any solution for this?

hz37's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Sure, but you gotta ask yourself what assumptions you can make about your input data. For instance, will you only feed your regular expression things that end with .png? Are you only interested in the three characters before the file extension? If so, you could do the following:

Published

Creative Commons License

Author