Regex assistance needed

Requests, feedback, and general discussion about WoWRoster
DO NOT post topics about WoWRoster AddOns here!

Regex assistance needed

Postby Scatmanicus » Sat Mar 12, 2011 9:12 am

This brings back old memories of headaches when I first setup Regex on our old guild back about 5 years ago.

Now I have a completely different player note on our guild. Our guild uses the main name first in brackets followed by a '#' pound sign for mains and '*' asterisk sign for alts with individual name and spec following.

Example:
Toon - Player Note
Malael - [Malael]# Luke (Fur* / Pro)
Tiadre - [Malael]* Luke (Des* / Aff)
Selten - [Malael]* Luke (Enh* / Res)

As ([\w]+) is the 1 word name for the main character , my confusion is differentiating between the main and the alts as 'alt' is not use anywhere in the note.

[/([\w]+)/]# is my best guess with the 'main name' regex contained within the start and end brackets and I have a '#' pound sign as the Main identifier which is to the right of the right bracket. I'm assuming there really is no need to have an 'alt' indicator or text as Roster will see the main name and if that character name does not match the 'main name', then it is an alt, obviously. Of course, that is just the programmer in me thinking with my logic which could be 'entirely' different from the WOWRoster developers. :lol:

However, this doesn't work. :cry:
Any feedback would be greatly appreciated.
Just another ol' Hacker!
Image
User avatar
Scatmanicus
WR.net Apprentice
WR.net Apprentice
 
Posts: 39
Joined: Fri Aug 11, 2006 4:03 am

Re: Regex assistance needed

Postby PleegWat » Sat Mar 12, 2011 2:22 pm

Your thinking is correct, your syntax isn't...

You just need to match the square brackets which occur both on mains and on alts. You don't need to match the # (since it only occurs on mains). Additionally you need to escape the new pair of square brackets since you want to match them literally.

\[([\w]+)\]

If you do want to explicitly match the # or *, add them between [] to the end:

\[([\w]+)\][\*#]

I'm not 100% sure from memory if you need to escape the * or not if you go that route.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Regex assistance needed

Postby Scatmanicus » Sat Mar 12, 2011 8:49 pm

I tried the following but none worked:

\[/([\w]+)/\]#

\[([\w]+)\][\*#]

\[([\w]+)\]#

The last one I came up with a ([\w]+) specifies the name of the character, so basically it should appear as \[Malael\]#. Since the \[ and \] should be ignored, that would give a final result of Malael#. As I have indicated that '#' is the main sign, it should strip that off and leave Malael as the character name. That logic may not be correct.

However, there may be other issues that is causing the problem.

When I update from the wowroster.lua file, It gives me this:

Processing Files
Could not find Guild. GuildProfiler Addon not installed correctly?
Updating Guild Data for [Thought Police@US-Bonechewer]

* Member Log
o Updated: 151
o Added: 0
o Removed: 0

But in the Update Profile link it only has updates for characterprofiler.lua, wowroster.lua, pvplog.lua and questguru.lua. There is no link for guildprofiler.lua. Also, as I had indicated in another post, the rpgo_CharacterProfiler and rpgo_GuildProfiler do not work in WOW as no 'Save' button appears anywhere, whether I have my usual addons enabled or all addons except those two disabled. The WoWRoster Character Profiler and WowRoster Guild Profiler does seem to work as the save buttons do appear, when I click save, it does show in the chat window what was updated, if I look at the wowroster.lua file, it does have data in it and if I update using the wowroster.lua file, it does add the guild members as well as the current character (Tiadre) to the WoWRoster and I can view details. The main thing that is not working is the matching up of mains and alts.

Here are all of my toons only from the last update which should be matched to Malael as that is my main but they are all shown as 'No main match - Main - No alts'.

o
o [ Blondell ]
o memberslist - No main match - Main - No alts
o
o [ Malael ]
o memberslist - No main match - Main - No alts
o
o [ Mordreda ]
o memberslist - No main match - Main - No alts
o
o [ Ladorion ]
o memberslist - No main match - Main - No alts
o
o [ Garmona ]
o memberslist - No main match - Main - No alts
o
o [ Thromah ]
o memberslist - No main match - Main - No alts
o
o [ Kaelvin ]
o memberslist - No main match - Main - No alts
o
o [ Zalian ]
o memberslist - No main match - Main - No alts
o
o [ Tiadre ]
o memberslist - No main match - Main - No alts
o
o [ Selten ]
o memberslist - No main match - Main - No alts
o
o [ Sephraia ]
o memberslist - No main match - Main - No alts

The player note in the wowroster.lua file for each character are as follows with 'Malael' tagged as main with '#':

Malael - ["Note"] = "[Malael]# Luke (Fur* / Pro)"
Blondell - ["Note"] = "[Malael]* Luke {Sdw / Hol}"
Garmona - ["Note"] = "[Malael]* Luke (Ass*)"
Kaelvin - ["Note"] = "[Malael]* Luke (Fer* / Res)"
Ladorian - ["Note"] = "[Malael]* Luke (Svl* / BM)"
Mordreda - ["Note"] = "[Malael]* Luke (Blo* / Unh)"
Selten - ["Note"] = "[Malael]* Luke (Enh* / Res)"
Sephraia - ["Note"] = "[Malael]* Luke (Ass*)"
Thromah - ["Note"] = "[Malael]* Luke (Fir* / Fro)"
Tiadre - ["Note"] = "[Malael]* Luke (Des* / Dem)"
Zalian - ["Note"] = "[Malael]* Luke (Ret* / Pro)"

Back long ago, we had the notes setup as 'M>Malael' and 'A>Malael' but the problem with this setup is that when you viewed the Guild window / Roster tab, select Guild Status and click on the Note label, we had all the mains shown together and each mains alts shown together but not all were shown together due to the alphabetical sorting. The way we have it now, all toons (mains and alts) are shown together with the mains listed first as '#' is sorted earlier than '*'. Our members really like this setup!

So if I can just get the Regex setup properly, all of our main goals with WoWRoster would have been met. Less significant things such as the non-working QuestGuru and others, we can live without.

Does anyone else have any suggestions?
Just another ol' Hacker!
Image
User avatar
Scatmanicus
WR.net Apprentice
WR.net Apprentice
 
Posts: 39
Joined: Fri Aug 11, 2006 4:03 am

Re: Regex assistance needed

Postby PleegWat » Sat Mar 12, 2011 11:57 pm

Hm, I don't get it. It seems to work in a quick test:

Code: Select all
preg_match( "/\[([\w]+)\]/", "[Malael]# Luke (Fur* / Pro)", $matches ); print_r($matches);'


Code: Select all
Array
(
    [0] => [Malael]
    [1] => Malael
)


Do note that whether your main matches the regex or not is not important. The alts are the ones that must match. For the mains you've got a bunch of options, but in your case it may be best to not let them match at all by including the '*' in the regex.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Regex assistance needed

Postby Ulminia » Sun Mar 13, 2011 2:21 am

try \[(.*)\]#
alt would be \[(.*)\]\*

this shoudl work ...

also this is the regex doc i used to work on roster
ereg_replace was depricieated this is the codingf or replacing special caracters..

All regex special chars (according to arkani at iol dot pt below):
\ ^ . $ | ( ) [ ]
* + ? { } ,

$patterns = array('/\//', '/\^/', '/\./', '/\$/', '/\|/',
'/\(/', '/\)/', '/\[/', '/\]/', '/\*/', '/\+/',
'/\?/', '/\{/', '/\}/', '/\,/');
$replace = array('\/', '\^', '\.', '\$', '\|', '\(', '\)',
'\[', '\]', '\*', '\+', '\?', '\{', '\}', '\,');


The following should be escaped if you are trying to match that character

\ ^ . $ | ( ) [ ]
* + ? { } ,

Special Character Definitions
\ Quote the next metacharacter
^ Match the beginning of the line
. Match any character (except newline)
$ Match the end of the line (or before newline at the end)
| Alternation
() Grouping
[] Character class
* Match 0 or more times
+ Match 1 or more times
? Match 1 or 0 times
{n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times
More Special Character Stuff
\t tab (HT, TAB)
\n newline (LF, NL)
\r return (CR)
\f form feed (FF)
\a alarm (bell) (BEL)
\e escape (think troff) (ESC)
\033 octal char (think of a PDP-11)
\x1B hex char
\c[ control char
\l lowercase next char (think vi)
\u uppercase next char (think vi)
\L lowercase till \E (think vi)
\U uppercase till \E (think vi)
\E end case modification (think vi)
\Q quote (disable) pattern metacharacters till \E
Even More Special Characters
\w Match a "word" character (alphanumeric plus "_")
\W Match a non-word character
\s Match a whitespace character
\S Match a non-whitespace character
\d Match a digit character
\D Match a non-digit character
\b Match a word boundary
\B Match a non-(word boundary)
\A Match only at beginning of string
\Z Match only at end of string, or before newline at the end
\z Match only at end of string
\G Match only where previous m//g left off (works only with /g)
Ulminia of Zangarmarsh
Zonous of Zangarmarsh
Author of Roster Gallery
WoWRoster-Profiler Redesigner
User avatar
Ulminia
WoWRoster.net Dev Team
WoWRoster.net Dev Team
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 1223
Joined: Tue Jul 04, 2006 4:41 pm
Location: New Brunswick, Canada
Realm: Zangarmarsh (PvE) - US
gmail/gtalk: ulminia@gmail.com

Re: Regex assistance needed

Postby Scatmanicus » Sun Mar 13, 2011 9:55 pm

PleegWat wrote:Hm, I don't get it. It seems to work in a quick test:

Code: Select all
preg_match( "/\[([\w]+)\]/", "[Malael]# Luke (Fur* / Pro)", $matches ); print_r($matches);'



Thanks PleegWat!

I changed the code form '[/([\w]+)/]#' to "/\[([\w]+)\]/", uploaded the wowroster.lua and, viola, all toons grouped up properly. :glad:

I'm a happy camper! :bounce:

Now if I can just get the rpgo_CharacterProfiler to work, members can begin uploading their information. On the WoWRoster, it shows http://www.rpgoutfitter.com/Addons/Char ... ofiler.cfm as being the location of the Character Profiler. However, on that page, it has rpgoCP v3.0.0; toc:30000 (2008-10-14) as the version number but in the sidebar is rpgo - CharacterProfiler v3.0.1 but if you click on the link, it still goes back to the same URL as listed above. On Curse.com, it has rpgo-CharacterProfiler v3.3.0 (1/14/2010).

So which one is the one to use for WoWRoster BETA v2.1?
Just another ol' Hacker!
Image
User avatar
Scatmanicus
WR.net Apprentice
WR.net Apprentice
 
Posts: 39
Joined: Fri Aug 11, 2006 4:03 am

Re: Regex assistance needed

Postby Ulminia » Sun Mar 13, 2011 11:15 pm

topic6264.html

our profiler i have recoded it for wow 4.X there are issues being beta and all .. this is an ace2/3 addon now...
Ulminia of Zangarmarsh
Zonous of Zangarmarsh
Author of Roster Gallery
WoWRoster-Profiler Redesigner
User avatar
Ulminia
WoWRoster.net Dev Team
WoWRoster.net Dev Team
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 1223
Joined: Tue Jul 04, 2006 4:41 pm
Location: New Brunswick, Canada
Realm: Zangarmarsh (PvE) - US
gmail/gtalk: ulminia@gmail.com

Re: Regex assistance needed

Postby Scatmanicus » Mon Mar 14, 2011 3:07 am

That is the version that I used to upload the guild and one of my characters (Tiadre) as logged in as administrator. So I logged in all of my toons on one account, enabled ONLY the WoW Roster Character Profiler addon and saved each character. I went to WoWRoster Update and used the WowRoster.lua file to upload? Each character was updated properly.

Now on the update page, it does have a window to browse and upload the Character Profiler. Shouldn't this be completely removed or should I use this window to 'only' upload the Character Profiler and then browse to the WoWRoster.lua file? If I upload the WoWRoster.lua file with the Character Profile upload window, I get the 'Guild Profiler' not found error.

Finally, under the WoWRoster CP / Update Access, there are not any options for Guild Data Level. Shouldn't there be an option there for 'Public / Administrator'? Oh, one more thing, I am not seeing any Realm Status. Where does this display?
Just another ol' Hacker!
Image
User avatar
Scatmanicus
WR.net Apprentice
WR.net Apprentice
 
Posts: 39
Joined: Fri Aug 11, 2006 4:03 am

Re: Regex assistance needed

Postby zanix » Mon Mar 14, 2011 5:54 am

Scatmanicus wrote:That is the version that I used to upload the guild and one of my characters (Tiadre) as logged in as administrator. So I logged in all of my toons on one account, enabled ONLY the WoW Roster Character Profiler addon and saved each character. I went to WoWRoster Update and used the WowRoster.lua file to upload? Each character was updated properly.

Now on the update page, it does have a window to browse and upload the Character Profiler. Shouldn't this be completely removed or should I use this window to 'only' upload the Character Profiler and then browse to the WoWRoster.lua file? If I upload the WoWRoster.lua file with the Character Profile upload window, I get the 'Guild Profiler' not found error.

Finally, under the WoWRoster CP / Update Access, there are not any options for Guild Data Level. Shouldn't there be an option there for 'Public / Administrator'? Oh, one more thing, I am not seeing any Realm Status. Where does this display?


The download in the topic is both addons, you can split off just wowroster to your members.
The new profiler works like CP and GP, where wowrostergp is the guild portion.

The WoWRoster 2.1 beta has places for CP.lua and wowroster.lua, because it will take either. But I wouldn't use both addons at the same time.
You will get the guild profiler not found error if you are logged in as admin. We haven't figured out how to clean that up a bit more.

Not sure what you mean about Update Access...
If you have the beta from the forum post, then the select boxes are broken.
They are fixed in the svn, but Ulminia should have another beta out by now...such a slacker!

Realmstatus is MIA because of the header/menu redesign. I'm trying to get time to redesign it to fit in the header somewhere...
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Re: Regex assistance needed

Postby Ulminia » Mon Mar 14, 2011 3:19 pm

byte me .. Rpgocp and wowrcp share the same update access rules ial pust a new beta update this week ... have been under the weather..
Ulminia of Zangarmarsh
Zonous of Zangarmarsh
Author of Roster Gallery
WoWRoster-Profiler Redesigner
User avatar
Ulminia
WoWRoster.net Dev Team
WoWRoster.net Dev Team
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 1223
Joined: Tue Jul 04, 2006 4:41 pm
Location: New Brunswick, Canada
Realm: Zangarmarsh (PvE) - US
gmail/gtalk: ulminia@gmail.com

Re: Regex assistance needed

Postby Scatmanicus » Mon Mar 14, 2011 4:36 pm

No problem. I do know what being under the weather is like. :)

For the time being, I'll just tell them to ignore the Character Profile update and only use the WoWRoster Update. Now if you can 'just' create a program that will hit the members in the head to get them to 'update' their profiles! jk

All in all mates, it looks pretty damn good! Great job!
Just another ol' Hacker!
Image
User avatar
Scatmanicus
WR.net Apprentice
WR.net Apprentice
 
Posts: 39
Joined: Fri Aug 11, 2006 4:03 am


Return to General Support & Feedback

Who is online

Users browsing this forum: No registered users and 1 guest

cron