|Anonymous | Login | Signup for a new account||2018-10-22 03:12 PDT|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001027||Documentation, Examples, and Web Site||Writing with Inform||public||2012-10-13 05:19||2014-05-07 07:38|
|Platform||x86||OS||Mac OS X||OS Version||10.8|
|Target Version||Fixed in Version||6L02|
|Summary||0001027: Section 19.6 is confusing about the role of square brackets in regular expressions|
|Description||Section 19.6 says:|
"In traditional regular expression language, square brackets rather than angle brackets are used for character ranges. In fact Inform does understand this notation (it treats square and angle brackets equally for this purpose), but square brackets would be annoying to type, since they already have a meaning in quoted text - for text substitutions."
This suggests that square brackets and angle brackets are treated the same in regexps. But in fact square brackets retain their role of indicating a text substitution, as well as character ranges.
|Minimal Source Text To Reproduce|
Lab is a room. After reading a command: if "axolotl barn swallow" matches the regular expression "\b[the player's command]\b": say "Match!"; otherwise: say "No match."; reject the player's command. Test me with "x/axolotl". [Note: "test me" won't actually do anything.]
|Additional Information||Perhaps nothing is actually false here, but it's confusing as all get-out. An example might be helpful.|
Forum thread http://www.intfiction.org/forum/viewtopic.php?f=7&t=6010&p=43154 [^]
|Tags||No tags attached.|
A possible clarification:
"In traditional regular expression language, square brackets rather than angle brackets are used for character ranges. In fact Inform does understand this notation, but only if you use "[bracket]" and "[close bracket]" because regular square brackets are used for text substitutions."
That's much clearer, but I think it could also use an explicit statement that it's OK to put text substitutions in the middle of regexps. Maybe with an example like this?
If we have
aeiou is a text that varies. aeiou is "lo".
The regular expression "b<aeiou>b" will match on "bab", "beb", "bib", "bob", and "bub".
The regular expression "b[aeiou]b" will match on "blob".
The regular expression "b[bracket]aeiou[close bracket]b" will match on "bab", "beb", "bib", "bob", and "bub".
Assuming that's right.
Felix Larsson (reporter)
There's a similar potentially misleading wording in Example 403, “About Inform’s regular expression support”:
«(i) Inform allows angle brackets as synonymous with square brackets, for reasons explained above.»
|2012-10-13 05:19||mattweiner||New Issue|
|2012-10-13 05:36||curiousdannii||Note Added: 0001898|
|2012-10-13 05:36||curiousdannii||Status||new => confirmed|
|2012-10-13 05:36||curiousdannii||Steps to Reproduce Updated||View Revisions|
|2012-10-13 10:50||mattweiner||Note Added: 0001899|
|2012-10-13 12:28||Felix Larsson||Note Added: 0001900|
|2014-01-25 09:00||graham||Status||confirmed => resolved|
|2014-01-25 09:00||graham||Resolution||open => fixed|
|2014-01-25 09:00||graham||Assigned To||=> graham|
|2014-05-07 07:37||jmcgrew||Fixed in Version||=> 6L02|
|2014-05-07 07:38||jmcgrew||Status||resolved => closed|
|Copyright © 2000 - 2010 MantisBT Group|