Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve RegEx documentation #2522

Closed
plokmijnuhby opened this issue Jun 10, 2019 · 4 comments · Fixed by godotengine/godot#36623
Closed

Improve RegEx documentation #2522

plokmijnuhby opened this issue Jun 10, 2019 · 4 comments · Fixed by godotengine/godot#36623

Comments

@plokmijnuhby
Copy link

The current documentation is okay as far as it goes, but in terms of how to write a regex, it simply states, "For a more in-depth look, you can easily find various tutorials and detailed explanations on the Internet." This is not good enough, because while most implementations of regex support *, ?, and other common patterns, the exact details vary between systems. Are (?R) groups supported? What metacharacters are available? Are matches multiline, are they case sensitive? Does . match newlines? Can we have at least some information on what Godot regexes actually are?

@Calinou
Copy link
Member

Calinou commented Jun 10, 2019

The regex module in Godot is based on PCRE2, but I don't know if there are specific caveats with regexes in Godot.

@plokmijnuhby
Copy link
Author

Could you add a note to that effect? Perhaps you could point people to this page, or this one.

@bojidar-bg
Copy link
Contributor

I guess we could also link people to https://www.pcre.org/current/doc/html/pcre2pattern.html.

@rslepon
Copy link

rslepon commented Aug 6, 2019

Version 2.1 documentation (https://docs.godotengine.org/en/2.1/classes/class_regex.html) had a list of supported features:
"Currently supported features:

  • Capturing () and non-capturing (?:) groups
  • Any character .
  • Shorthand character classes \w \W \s \S \d \D
  • User-defined character classes such as [A-Za-z]
  • Simple quantifiers ?, \* and +
  • Range quantifiers {x,y}
  • Lazy (non-greedy) quantifiers \*?
  • Beginning ^ and end $ anchors
  • Alternation |
  • Backreferences \1 and \g{1}
  • POSIX character classes [[:alnum:]]
  • Lookahead (?=), (?!) and lookbehind (?<=), (?<!)
  • ASCII \xFF and Unicode \uFFFF code points (in a style similar to Python)
  • Word boundaries \b, \B"

Perhaps it could be copied into the 3.x documentation and modified, if necessary. If doing so, note that \* in bullet 5 should be * and \*? in bullet 7 should be *?, I believe.

Calinou added a commit to Calinou/godot that referenced this issue Feb 27, 2020
akien-mga pushed a commit to akien-mga/godot that referenced this issue Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants