zarqon
Well-known member
Ok, my non-regex-phobic scripting friends! The time has come.
I am issuing a challenge.
Write either 1) a matcher, or 2) a contains_text() wrapper function that accounts for the Sword Behind. This would have a wide variety of uses and would almost certainly be added to ZLib as a contains_text() alternative. Presently, scripters need to be careful to avoid matching strings that contain the prepositions listed here.
For example in the following text:
Beside the river and in the woods, of grandmother's house we go.
If you are wearing the sword, that.contains_text("Over the river and through the woods") will return false. But this wrapper function should account for the sword's swapping of prepositions and return true.
I'm pretty sure this is not solely a regex problem, but will undoubtedly involve regexes in the solving. It gets even more interesting when you consider that prepositions with punctuation following do not match! Good luck!
I am issuing a challenge.
Write either 1) a matcher, or 2) a contains_text() wrapper function that accounts for the Sword Behind. This would have a wide variety of uses and would almost certainly be added to ZLib as a contains_text() alternative. Presently, scripters need to be careful to avoid matching strings that contain the prepositions listed here.
For example in the following text:
Beside the river and in the woods, of grandmother's house we go.
If you are wearing the sword, that.contains_text("Over the river and through the woods") will return false. But this wrapper function should account for the sword's swapping of prepositions and return true.
I'm pretty sure this is not solely a regex problem, but will undoubtedly involve regexes in the solving. It gets even more interesting when you consider that prepositions with punctuation following do not match! Good luck!