I have a string and I am trying to extract a particular section of from it using a LUA pattern match. I saved this as regex which you can see here, along with the string and regex syntax which extracts the exact section I want (the green capture group). I have converted this to the LUA equivelent pattern syntax which is:
result = {string.match(description, "Weapons.-\n(.*)\n\n")}
but it errors saying "pattern to complex". The weird thing though is that I tried to troubleshoot this as I assumed I made a mistake in the conversion, if I remove the last \n
it does work, but it captures the abilities section too, which is undesirable. I think my syntax is correct, because when I remove that \n
and also remove it from the regex, they both match the same data... so what goes wrong when I add two \n
s in LUA??
I have lots of differnt ways and I get some weird results so I am starting to think that this is kind of bug in LUA itself.
One extra thing I'd like to point out which may help, is that I am doing this in Tabletop Simulator which I believe uses Moonsharp (which is a LUA interpreter). Can anyone advise on what is going on here or how to tweak it to capture the data I want?
thanks,