PDA

View Full Version : REGEXP and case sensitive stuff



horseshoecrab
02-18-2004, 06:25 PM
Hi all,

After taking the plunge into beta 6, I found myself a little confused by the .xml filter structure and the cryptic hint from Zaphod (search results) about how to deal with case sensitive issues. Since a few people seemed to ask the question and it was never directly answered, what follows is a quick answer to a relatively simple problem.

Here are the contents of the iceclad.xml file. As it turns out, setting the "case sensitive" option in the SEQ gui doesn't make any difference if the case is incorrect in the filter file itself. In this situation, it is possible to get what you need with a simple change.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE seqfilters SYSTEM "seqfilters.dtd">
<seqfilters>
<section name="Hunt">
<oldfilter><regex>Name:rabid snow cougar</regex></oldfilter>
</section>
<section name="Caution">
</section>
<section name="Danger">
<oldfilter><regex>Name:Commander Kvarid</regex></oldfilter>
<oldfilter><regex>Name:Commander Vjorik</regex></oldfilter>
<oldfilter><regex>Name:frost giant skirmisher</regex></oldfilter>
<oldfilter><regex>Name:Kromrif tracking wolf</regex></oldfilter>
</section>
<section name="Locate">
<oldfilter><regex>Name:lodizal</regex></oldfilter>
<oldfilter><regex>Name:stormfeather</regex></oldfilter>
</section>
<section name="Alert">
<oldfilter><regex>Name:#Midnight</regex></oldfilter>
<oldfilter><regex>Name:#dire wolf stalker</regex></oldfilter>
<oldfilter><regex>Name:#pulsating icestorm</regex></oldfilter>
<oldfilter><regex>Name:Balix Misteyes</regex></oldfilter>
<oldfilter><regex>Name:Garou</regex></oldfilter>
<oldfilter><regex>Name:General Bragmur</regex></oldfilter>
<oldfilter><regex>Name:Lodizal</regex></oldfilter>
<oldfilter><regex>Name:Stormfeather</regex></oldfilter>
<oldfilter><regex>Name:a lost pirate</regex></oldfilter>
<oldfilter><regex>Name:rabid snow cougar</regex></oldfilter>
</section>
<section name="Filtered">
</section>
</seqfilters>

I am choosing iceclad for the simple reason that the filter as it was distributed has a problem that is easily fixed and provides a good lesson for handling other situations you may run across. Notice above that Lodizal and Stormfeather are mentioned twice, once each in the Locate heading, and again in Alert. What's noteworthy here is that neither mob is going to show up under locate for the simple reason that their names should be capitalized but aren't. In situations where you want to watch specific mobs and the case is unknown, you can use this syntax instead.

<oldfilter><regex>Name:[Ll]odizal</regex></oldfilter>
<oldfilter><regex>Name:[Ss]tormfeather</regex></oldfilter>

By placing both the upper and lowercase form of the first letter together in brackets, the filter file will look for Lodizal and lodizal, Stormfeather and stormfeather, respectively. It could also be done with creatures with more than one name such as [Gg]eneral [Bb]ragmur if you have such a need.

Hope this is helpful. Also, here is a regex resource I found on the net that led me to these solutions.

http://www.zytrax.com/tech/web/regex.htm

S_B_R
02-18-2004, 09:48 PM
Welcome to the wonderful word of RegEx. This is only the tip of the iceberg. :)