Raised This Month: $ Target: $400
 0% 

Hook name with dot and number


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 08-12-2011 , 12:13   Hook name with dot and number
Reply With Quote #1

Ok, I'd like to hook name which
a) contains a dot and number
For instance:
PHP Code:
.2 
or
PHP Code:
4. 
b) contains more than two dots
For instance:
PHP Code:
M.I.K.
Any ideas?
Racoon is offline
Send a message via ICQ to Racoon
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-12-2011 , 12:17   Re: Hook name with dot and number
Reply With Quote #2

Use this regex pattern:

.*(\d\.|\.\d|\..*\.).*
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 08-12-2011 , 12:51   Re: Hook name with dot and number
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
Use this regex pattern:

.*(\d\.|\.\d|\..*\.).*
Seems it works. As far as I understood you put both my requests in one code. What would the string look like only with a) request? Thanks in advance.
Racoon is offline
Send a message via ICQ to Racoon
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-12-2011 , 13:20   Re: Hook name with dot and number
Reply With Quote #4

Remove the last switch option in the pattern.

.*(\d\.|\.\d).*
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 08-12-2011 , 13:34   Re: Hook name with dot and number
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
Remove the last switch option in the pattern.

.*(\d\.|\.\d).*
Works perfectly! Thanks again.
Racoon is offline
Send a message via ICQ to Racoon
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 08-13-2011 , 13:58   Re: Hook name with dot and number
Reply With Quote #6

One more thing. Can you give a hint how to hook chat message, which contains more than 4 digits (that are not in a row) using regex?
Racoon is offline
Send a message via ICQ to Racoon
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-13-2011 , 16:27   Re: Hook name with dot and number
Reply With Quote #7

I assume you don't know how to form regex patterns.

((^|\D)\d(?!\d))

Be sure to escape the ^ when you use it in the plugin.
You will need to also count your matches and check if they are 4 or more.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Racoon
Senior Member
Join Date: Mar 2008
Location: Ukraine
Old 08-14-2011 , 04:28   Re: Hook name with dot and number
Reply With Quote #8

Quote:
Originally Posted by Exolent[jNr] View Post
I assume you don't know how to form regex patterns.

((^|\D)\d(?!\d))

Be sure to escape the ^ when you use it in the plugin.
You will need to also count your matches and check if they are 4 or more.
I've always had difficulties with regex regular expressions
Racoon is offline
Send a message via ICQ to Racoon
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode