When using backrefrences for regexes along with matching amounts, dream demon runtimes with the following error
runtime error: Regex fail: * + {} operand could be empty
Regex to test directly in other languages or regex101: ((\n)\2{2})\2+
Numbered Steps to Reproduce Problem:
-> create the regex
-> run a valid text through the regex
Code Snippet (if applicable) to Reproduce Problem:
var/a = "text\n\n\n\ntext"
world.log << a
var/regex/reg = regex("((\\n)\\2{2})\\2+")
world.log << replacetext(a, reg, "$1")
Expected Results:
text\n\n\ntext
Actual Results:
runtime error: Regex fail: * + {} operand could be empty
Does the problem occur:
Every time? Or how often? yes
In other games? only tested on ss13
In other user accounts? server side
On other computers? server side
When does the problem NOT occur?
When not using backrefrences along with {} like in the example above
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Did not test it on earlier versions, yet
Workarounds:
writing a horrible regex...
I know some engines do allow \2 to be used before the 2nd group, which BYOND also doesn't support, but being used inside the group itself makes no sense; that'd be a recursion.