• Welcome to Vice City Multiplayer.
 

Extract Clan Tags from Nick-Name

Started by rulk, September 07, 2009, 09:42:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rulk

Hya guys,

This is my version of extracting the clan tag from a players name.

It uses mIRC's regex engine and is pretty fast because strings are cached before using them.


; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered:
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Note: Combinations are also valid.
; --------------------------

alias FindClanTag {
  var %HasTag = $regex( $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
  if (%HasTag > 0) return $regml(1)
}



Some superb regex tutorials and one hour tests can be found at #regex on the undernet network "irc.undernet.org"

alternatively, you might find reading THIS WEBSITE beneficial

I have enjoyed using both methods and can be found taking the regex tests quite regularly, if you need any assistance in breaking down this particular expression, don't hesitate to ask me.

Hope this helps you guys.

Kind Regards

Luke Rudge (rulk)

[XT]ariel[X]

Clic in image from enter in my web :D

rulk

#2
Hya guys,

Here is an update on the clan tag extraction using mIRC's regex engine.

It now covers both single and double delimiter clan tags (apologies to ULK. for excluding them)

I have decided not to couple both expressions into one, to eliminate confusion for beginners.

I recommend that unless this update is needed you stick with the one in the first post.


; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered: (Double Delimiter)
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Tags Covered: (Single Delimiter)
; ULK. ULK_ ULK=
;
; Note: Combinations are also valid for double delimiter tags.
; Note: Combinations are NOT valid for single delimiter tags
; --------------------------

alias FindClanTag {
  var %Double_Delim = $regex( D_DELIM, $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
  var %Single_Delim = $regex( S_DELIM, $1,  (\w+[.=_]+) )
  return $iif( %Double_Delim > 0, $regml(D_DELIM, 1), $regml(S_DELIM, 1) )
}


Happy coding.

Kind Regards

Luke Rudge (rulk)

thijn



creepers

the underscore isn't a good idea for a clan tag detection

like if The_Don comes in without a tag, the clan would be "The"
December 18, 2007
January 6, 2008

Usaji

Great Alias rulk, but would u please rewrite the alias so it does not detect the ULK_ ?

Thanks in advance

Obito

Quote from: creepers on September 11, 2009, 11:59:27 PM
the underscore isn't a good idea for a clan tag detection

like if The_Don comes in without a tag, the clan would be "The"
wrong
that will happend if his nick was :
_The_Don

creepers

Quote from: Obito on September 13, 2009, 04:29:48 AM
Quote from: creepers on September 11, 2009, 11:59:27 PM
the underscore isn't a good idea for a clan tag detection

like if The_Don comes in without a tag, the clan would be "The"
wrong
that will happend if his nick was :
_The_Don

?_?

Quote; Tags Covered: (Single Delimiter)
; ULK. ULK_ ULK=
i meant only 1
December 18, 2007
January 6, 2008

rulk

#8
Hya Guys,

Tag detection without an underscore for single delimiter


; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered: (Double Delimiter)
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Tags Covered: (Single Delimiter)
; ULK. ULK=
;
; Note: Combinations are also valid for double delimiter tags.
; Note: Combinations are NOT valid for single delimiter tags
; --------------------------

alias FindClanTag {
  var %Double_Delim = $regex( D_DELIM, $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
  var %Single_Delim = $regex( S_DELIM, $1,  (\w+[.=]+) )
  return $iif( %Double_Delim > 0, $regml(D_DELIM, 1), $regml(S_DELIM, 1) )
}


Any other combinations that need to be removed/added let me know

Kind Regards

Luke Rudge (rulk)

[AoD]NC

Great work rulk! Ideal for clan stats etc.

Btw. the code looks a bit complicated ;D.

Anyway, there is a polish clan with tag L.Team*. Using this script should return "L"...
* [AoD]NC wonders why clans cant have tags in [ ]

rulk

#10
Hya [AoD]NC,

Theres going to be a few tags that wont be catered for, but as they pop up, its simple to add them.

Here is a special edition for your polish friends.


; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered: (Double Delimiter)
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Tags Covered: (Single Delimiter)
; ULK. ULK= L.Team*
;
; Note: Combinations are also valid for double delimiter tags.
; Note: Combinations are NOT valid for single delimiter tags
; --------------------------

alias FindClanTag {
  var %Double_Delim = $regex( D_DELIM, $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
  var %Single_Delim = $regex( S_DELIM, $1,  (\w.+[.*=]+) )
  return $iif( %Double_Delim > 0, $regml(D_DELIM, 1), $regml(S_DELIM, 1) )
}


Hope this helps

Kind Regards


Luke Rudge (rulk)

kaje

Hey, rulk.
I've read the codes, But I still didn't understood why is this nessecary?

SianMaenad


rulk

Hya Guys,


Here is an amended version, thanks for your comments so far.

kaje: Its a small snippet aimed at people that wish to obtain the clan tag from the players name for whatever purposes they desire.


; -----------USAGE----------
; //echo -a $FindClanTag([MK]rulk)
;
; Tags Covered: (Double Delimiter)
; [MK] (MK) =MK= ^MK^ <MK> -MK-
;
; Tags Covered: (Single Delimiter)
; ULK. ULK= L.Team*
;
; Note: Combinations of characters are also valid for
;       both double and single delimiter tags.
; --------------------------

alias FindClanTag {
  var %Double_Delim = $regex( D_DELIM, $1, /([[(=^<-]+\w+.[])=^>-]+)/ )
  var %Single_Delim = $regex( S_DELIM, $1,  (\w.+[.*=]+) )
  return $iif( %Double_Delim > 0, $regml(D_DELIM, 1), $regml(S_DELIM, 1) )
}


Dont forget, if there is any combination that you require me to add/remove dont hesitate to ask.

Kind Regards

Luke Rudge (rulk)

[AoD]NC