Hello, currently I’m working on a string parser which includes extracting text between asterisks and using it for some purpose. Currently, this algorithm works.
local str = "get this text: *foo*"
local textGotten = str:match("%b**")
-- I am using the %bxy pattern in to detect the text between the asterisks.
-- Now, when i print(str) -> "foo"
But, what I’m trying to do is figure out how to detect “*text*” and “**text**” with the double asterisks. Unfortunately the %bxy pattern isn’t working for me, and I attempted to perhaps subsitute x for [**] and y for [**] for the pattern → “%b[**][**]”. As good of an attempt it was, this did not properly collect the text in between the double asterisk.
Is there a pattern I can use to capture text between a double, or even triple asterisk using pure string patterns/regex, without running the %b** pattern twice(which works, but is not ideal.)?