Hey , I’m trying to figure out how I can use Regex to extract the location of phrases like **, *, ~~, __, etc.
This is for the purpose of creating a module that detects Markdown and returns an array of words, substring positions, and the symbol that was flagged. I’m uncertain if there are better ways to detect this, but I would assume Regex detection would be my best bet!
How can I traverse this problem? Are there resources that explain roblox’s specific version of Regex?
Any help is appreciated!
Hi! Roblox (to my knowledge) doesn’t have a Regex builtin or library, but we can use Luau string patterns as a partial replacement instead (look up create.roblox string pattern reference). It’s missing stuff like lookaround and more advanced regex features, but I’ve found patterns useful enough to solve most common problems. If you need an actual pure Luau Regex implementation, I *think* we have some open source libs available (but will have to look).
Could you give a little more info about your usecase & where you’re expecting md syntax?
Could you link some resources if you know any by chance? I’ll definitely do my part in searching for these
For sure! My usecase would be streamline any work with markdown by creating an open sourced utility module that is both performant and provides decent developer UX. More specifically, this would extract regex from any provided string and would spew out data about where cases are found, what the extracted word is, etc. This would allow for the mixture of complex patterns as well, such as Hello world (uses “***” and “~”)
I figured this would be work-intensive on my end to achieve my goals, so I definitely think I should have a strong understanding of Roblox’s pattern functions and how regex generally works!