Boost Regex cheat sheet

Is there any reason why this would be anything but a reliable reference, for using the built-in regular expressions library from within SC?

https://www.boost.org/doc/libs/1_31_0/libs/regex/doc/syntax.html

Are there any others?

1 Like

Are there any others?

(references, cheat sheets, etc…)

When I need to make or debug/test a regex, I tend to use this website:

It also has documentation/description of the various regex elements, and supports several different syntaxes. I used regexes a lot in my SC live coding tools, and found it helpful.

Glen.

Thanks for this… which “flavor” of regular expression syntax is an identical match to the syntax for the C++/Boost library used in SC?

The default “flavour” for the C++ standard library regex is ECMAScript, and I think it’s the same for Boost (I believe SC uses Boost’s regex implementation).

Searching in the code, it looks like SC is also explicitly requesting ECMAScript regex syntax…

1 Like

This really should be documented better in the help files. Would someone be up for making a PR for it?

It turns out the exact reference for the correct syntax, or the specific flavor of boost used in SC, is present in the documentation.
.

This demonstrates the perl syntax as being equivalent to ECMAScript:

https://www.boost.org/doc/libs/1_69_0/libs/regex/doc/html/boost_regex/ref/syntax_option_type/syntax_option_type_perl.html

Ah that’s nice, but I think the examples are still way too limited. We need more examples of searching for version numbers etc. Doing things like this is what I mean:

"version 2.30.10 is what the version is".findRegexp("[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")

It seems there should be a highly organized way for every user to essentially become a documentation contributor without any hassle.

If everyone had a streamlined opportunity to submit there own usage cases, then we would essentially achieve a singularity of referential information throughout the entire community.

If one could add to everyone’s knowledge without having to go out of one’s way, then everyone would get further in every way.

1 Like

A terse list of finely cut regular expression statements coded purely in SC would be a perfect example, in this case.

It’s not exactly hassle free but a lot of effort has been put into documenting and explaining the process [WIP] contributing helpfiles · supercollider/supercollider Wiki · GitHub

1 Like

Thanks again for the link.

I’m not arguing but trying to move forward in this vision… the browser should be the editor, and it should update a documentation branch automatically.

The problem with this would be a flood of editing & information across the broad spectrum of the uninitiated.

If there were a ‘doc contribute’ quark with a full-featured graphical text editor and help browser, then it would put enough distance between the effort and the action as to make it less accessible for the more unreliable sources of information, while accessible enough for those who would benefit from a streamlined method for contributing efforts.