'How can I simply extract a variable with Rascal Regex

If I process a simple string with a regex, I expect I can extract variables. The examples in the manual states that the extraction results in a stored variable. This does not work as expected. If I do the following regex:

/\w*<subtext:text>\w*/ := "myfulltextstring"

I would expect the variable subtext to contain the string text. But it is undeclared. If I declare subtext before executing, it is empty. What is the simple way to do this extraction?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source