Author Topic: Extract Clan Tags from Nick-Name  (Read 10500 times)

0 Members and 1 Guest are viewing this topic.

rulk

  • Guest
Extract Clan Tags from Nick-Name
« on: September 07, 2009, 11:42:37 pm »
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.

Code: [Select]
; -----------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)
« Last Edit: September 15, 2009, 06:28:31 am by rulk »

Offline [XT]ariel[X]

  • Wiseguy
  • **
  • Posts: 58
  • Hi all!!
    • View Profile
    • American Server
Re: Extract Clan Tags from Nick-Name
« Reply #1 on: September 08, 2009, 03:05:52 am »
ok tranks :)
Clic in image from enter in my web :D

rulk

  • Guest
Re: Extract Clan Tags from Nick-Name
« Reply #2 on: September 08, 2009, 05:56:42 pm »
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.

Code: [Select]
; -----------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)
« Last Edit: September 15, 2009, 06:29:10 am by rulk »

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Extract Clan Tags from Nick-Name
« Reply #3 on: September 08, 2009, 08:51:00 pm »
Very nice!

Offline creepers

  • Wiseguy
  • **
  • Posts: 50
    • View Profile
Re: Extract Clan Tags from Nick-Name
« Reply #4 on: September 12, 2009, 01:59:27 am »
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

Offline Usaji

  • Street Thug
  • *
  • Posts: 13
    • View Profile
Re: Extract Clan Tags from Nick-Name
« Reply #5 on: September 13, 2009, 04:57:27 am »
Great Alias rulk, but would u please rewrite the alias so it does not detect the ULK_ ?

Thanks in advance

Offline Obito

  • Street Thug
  • *
  • Posts: 7
    • View Profile
Re: Extract Clan Tags from Nick-Name
« Reply #6 on: September 13, 2009, 06:29:48 am »
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

Offline creepers

  • Wiseguy
  • **
  • Posts: 50
    • View Profile
Re: Extract Clan Tags from Nick-Name
« Reply #7 on: September 13, 2009, 08:11:31 am »
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

  • Guest
Re: Extract Clan Tags from Nick-Name
« Reply #8 on: September 13, 2009, 06:35:35 pm »
Hya Guys,

Tag detection without an underscore for single delimiter

Code: [Select]
; -----------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)
« Last Edit: September 15, 2009, 06:29:30 am by rulk »

Offline [AoD]NC

  • VC:MP Beta Tester
  • VC:MP Veteran
  • *
  • Posts: 616
  • AoD forever!
    • View Profile
    • KURWA MAĆ
Re: Extract Clan Tags from Nick-Name
« Reply #9 on: September 13, 2009, 07:53:07 pm »
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

  • Guest
Re: Extract Clan Tags from Nick-Name
« Reply #10 on: September 13, 2009, 08:40:54 pm »
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.

Code: [Select]
; -----------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)
« Last Edit: September 15, 2009, 06:29:48 am by rulk »

Offline kaje

  • Street Thug
  • *
  • Posts: 3
    • View Profile
Re: Extract Clan Tags from Nick-Name
« Reply #11 on: September 13, 2009, 10:24:57 pm »
Hey, rulk.
I've read the codes, But I still didn't understood why is this nessecary?

Offline SianMaenad

  • Street Thug
  • *
  • Posts: 1
    • View Profile
Re: Extract Clan Tags from Nick-Name
« Reply #12 on: September 14, 2009, 08:23:56 am »
its in the titel

rulk

  • Guest
Re: Extract Clan Tags from Nick-Name
« Reply #13 on: September 14, 2009, 10:03:13 pm »
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.

Code: [Select]
; -----------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)

Offline [AoD]NC

  • VC:MP Beta Tester
  • VC:MP Veteran
  • *
  • Posts: 616
  • AoD forever!
    • View Profile
    • KURWA MAĆ
Re: Extract Clan Tags from Nick-Name
« Reply #14 on: September 15, 2009, 03:13:05 pm »
Rulk u are pr0! :D