philmasterplus
Active member
KoLmafia r20631: Due to a flawed regex pattern in
The regex tries to match the value of the
I'm posting a patch that fixes this. Since parsing HTML with regex is inherently tricky, I rewrote the methods
Note that
ChoiceUtilities.java
, the available_choice_select_inputs()
function incorrectly parses certain choice adventures. For example, the Fortune Teller page contains the following HTML:
HTML:
<select name="which" id="which" required>
...
</select>
The regex tries to match the value of the
name
attribute, but matches which" id="which" required
instead.I'm posting a patch that fixes this. Since parsing HTML with regex is inherently tricky, I rewrote the methods
parseSelectInputsWithTags()
and parseTextInputs()
using HtmlCleaner and XPath instead. I also added a couple of test cases for them.Note that
parseSelectInputsWithTags()
is also called by several functions that process choice adventures. This patch may cause unforeseen breakages. While a quick playtest revealed no problems, I still feel it needs a bit more testing before being integrated.