Regex problem

Scans for, and displays main/alt relations in your Guild

Moderator: PleegWat

Regex problem

Postby dabuddha » Fri Mar 30, 2007 10:35 pm

Having problems getting my regex defined properly and any help would be greatly appreciated :)

Here's what I'm putting in the public note field for alts:

ALT: Mainname

i.e.

ALT: dabuddha

So I tried to put the following in my regex field:

Code: Select all
/ALT:([\w]+)/i


When I do the update relations, I get the following for each member:

.
.
.
Paladino - No main match - Main - No alts
- 0 records without matching member records deleted

I have Apply on field set to Public note
Use match no - 1
Main identifier - Main
No Result - Main
Invalid Result - Mainless Alt
Alt of Alt - Set as Mainless Alt
Update Type - Both
TIA :)
Last edited by dabuddha on Fri Mar 30, 2007 10:37 pm, edited 1 time in total.
dabuddha
WR.net Apprentice
WR.net Apprentice
 
Posts: 2
Joined: Wed Jul 26, 2006 1:22 am

Regex problem

Postby PleegWat » Fri Mar 30, 2007 11:04 pm

If there is a space between the : and the name in your notes, it also needs to be in the regex:
Code: Select all
/ALT:\s([\w]+)/i
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 problem

Postby dabuddha » Fri Mar 30, 2007 11:08 pm

PleegWat wrote:If there is a space between the : and the name in your notes, it also needs to be in the regex:
Code: Select all
/ALT:\s([\w]+)/i


You rock! That seemed to do the trick :)
dabuddha
WR.net Apprentice
WR.net Apprentice
 
Posts: 2
Joined: Wed Jul 26, 2006 1:22 am

Re: Regex problem

Postby mfoley » Tue Sep 18, 2007 5:28 am

PleegWat wrote:If there is a space between the : and the name in your notes, it also needs to be in the regex:
Code: Select all
/ALT:\s([\w]+)/i


I have a similar question in attempting to get this to work. In our Officer notes for ALT toons, we have:

Code: Select all
ALT - Revlon


...with "Revlon" being an example of a main. So based on what I've been seeing in these forums, our regex string should be thus:

Code: Select all
/ALT\s-\s([\w]+)/i


Is that correct? (Assuming, of course, we are keying off the Officer Notes.)
User avatar
mfoley
WR.net Apprentice
WR.net Apprentice
 
Posts: 55
Joined: Tue Aug 08, 2006 11:27 am

Regex problem

Postby zanix » Tue Sep 18, 2007 5:33 am

Looks ok to me
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 problem

Postby mfoley » Tue Sep 18, 2007 5:48 am

zanix wrote:Looks ok to me


Hmmm...well it doesn't seem to be working in the AltMonitor app and when I test the expression here, it's indicating "No Matches" when I use

Code: Select all
ALT - Revlon


...as the source input and...

Code: Select all
/ALT\s-\s([\w]+)/i


...as the test pattern.

I'm attempting to school myself in some basic regex in the meantime but if there's an obvious error anyone can point out, that would surely help short circuit my stuck.
Last edited by mfoley on Tue Sep 18, 2007 5:49 am, edited 1 time in total.
User avatar
mfoley
WR.net Apprentice
WR.net Apprentice
 
Posts: 55
Joined: Tue Aug 08, 2006 11:27 am

Regex problem

Postby ds » Tue Sep 18, 2007 6:10 am

It is because the webpage tool you are using. It does not expect the pattern delimiters or pattern params. that is the
Code: Select all
/ /i


The pattern you tested works fine... and in english it is doing this:

Will Match "ALT" Literally ALT
Will match ONE white space character \s
Will Match "-" Literally -
Will match ONE white space character \s
Starts Capture group 1 (
Will Capture a word character between 1 and unlimited amount of times greedy [\w+]
End Capture group 1 )

That help at all?

the /i makes it Case Insensitive match
Last edited by ds on Tue Sep 18, 2007 6:14 am, edited 2 times in total.
Image
ds
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 297
Joined: Sat Jul 08, 2006 9:58 am

Re: Regex problem

Postby mfoley » Tue Sep 18, 2007 7:00 am

ds wrote:It is because the webpage tool you are using. It does not expect the pattern delimiters or pattern params. that is the
Code: Select all
/ /i


The pattern you tested works fine... and in english it is doing this:

Will Match "ALT" Literally ALT
Will match ONE white space character \s
Will Match "-" Literally -
Will match ONE white space character \s
Starts Capture group 1 (
Will Capture a word character between 1 and unlimited amount of times greedy [\w+]
End Capture group 1 )

That help at all?

the /i makes it Case Insensitive match


I'm befuddled then because I've been assured by the officers that the officer's note is indeed being populated using the "ALT - MAIN" pattern and when I double check my configuration, save the settings, then update the relationships, the only ALT groupings are a result of manually updated character LUA files via the roster (there are two mains with 2 or 3 alts tiered underneath).

Is there a WIKI page for this add-on. I hate to take up anyone's time if there's something obvious in the configuration I should have made myself aware of.

Thanks for your time (and Zanix too).
User avatar
mfoley
WR.net Apprentice
WR.net Apprentice
 
Posts: 55
Joined: Tue Aug 08, 2006 11:27 am

Regex problem

Postby ds » Tue Sep 18, 2007 7:47 am

Well you could make the pattern a bit more loose... perhaps something like this:

/alt\s?-?\s?(\w+)/i

This would match:
alt-NAME
alt - NAME
alt -NAME
alt- NAME
alt NAME
alt NAME
etc
Image
ds
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 297
Joined: Sat Jul 08, 2006 9:58 am

Regex problem

Postby Subxero » Tue Sep 18, 2007 8:28 am

There are posibility to add not case sensitivy at "alt" text ?

that match with:

ALT, Alt, alt ..

Or its already with /i ?
Last edited by Subxero on Tue Sep 18, 2007 8:29 am, edited 1 time in total.
Subxero - Priest 70 Holy - Asphelt Knight Officer - Zul'jin Horde.
User avatar
Subxero
WR.net Artisan
WR.net Artisan
 
Posts: 234
Joined: Thu Jul 06, 2006 4:08 pm
Realm: Zul'jin (PvE) - US

Regex problem

Postby ds » Tue Sep 18, 2007 8:39 am

/i does that. (case insensitive)
Image
ds
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 297
Joined: Sat Jul 08, 2006 9:58 am

Re: Regex problem

Postby lnwulf » Fri Jan 11, 2008 4:04 pm

I'm running the AltMonitor for DF in case it matters.

I don't get it at all, I'm using

Code: Select all
/([w]+)'s alt/i


and my guild list officer's note as the field with is set to "MainName's Alt" and I just keep getting:

MainName - Main: MainName - Main - No alts
- 0 records without matching member records deleted


For every entry in my guild list...

Please help :?
User avatar
lnwulf
WR.net Apprentice
WR.net Apprentice
 
Posts: 4
Joined: Sat Dec 15, 2007 5:19 am

Regex problem

Postby PleegWat » Fri Jan 11, 2008 6:52 pm

Should be \w, not w
The \ may be disappearing, in that case you should put \\ (and remember to put that in again each time you change config...). This is fixed in mainstream AltMonitor, but I don't think that version got ported to DF.
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 problem

Postby lnwulf » Sat Jan 12, 2008 5:02 am

WHOOT! that did it ... thank you, thank you so very much :D
User avatar
lnwulf
WR.net Apprentice
WR.net Apprentice
 
Posts: 4
Joined: Sat Dec 15, 2007 5:19 am

Re: Regex problem

Postby Dyaxler » Fri Jan 25, 2008 8:16 am

All my guild's mains are using the designation Main in the public note. Sometimes we add additional notes such as "Main Armorsmith/Miner" etc. But the word Main is the first word that appears in the public note. All guild alts are using the tag, for example, "Dyaxler alt"

The Regex I'm using is:
Code: Select all
/([\w]+)\salt/i


I don't think the additional info along with the Main identifier is messing things up because not all toons have additional notes. When I update relations, I get the same result for each character:
"No main match - Main - No alts"

Relations seem to work ok when ever someone uploads their profile. LOL... I'm sure it's my Regex but man am I stumped. :D

Apply on field: Public Note
Use Match No: 1
Main Identifier: Main
No Result: Tried both
Invalid Result: Tried both
Alt of Alt: Tried all options
Update Type: Both

AltMonitor: latest version
WoWRoster: v1.9.9.1590
PHP version: 5.2.5
MySQL version: 4.1.22-standard
MySQL client version: 4.1.21
Dyaxler
WR.net Apprentice
WR.net Apprentice
 
Posts: 48
Joined: Sat Jan 05, 2008 4:51 pm

Next

Return to AltMonitor

Who is online

Users browsing this forum: No registered users and 1 guest