SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 09/07/2017, 03:45 PM   #21
YourShadow
Big Clucker
 
YourShadow's Avatar
 
Join Date: Apr 2016
Posts: 118
Reputation: 232
Default Re: Pawn.Regex - full support of regular expressions

Quote:
Originally Posted by Salik View Post
Actually, i got this message in my project, Fix this pls.
Fixed.
YourShadow is offline   Reply With Quote
Old 10/07/2017, 03:03 PM   #22
Salik
Big Clucker
 
Salik's Avatar
 
Join Date: Aug 2015
Location: Russia
Posts: 87
Reputation: 0
Thumbs up Re: Pawn.Regex - full support of regular expressions

Quote:
Originally Posted by YourShadow View Post
Fixed.
Thanks!
Salik is offline   Reply With Quote
Old 18/07/2017, 12:22 AM   #23
Barnwell
Banned
 
Join Date: May 2014
Location: England
Posts: 603
Reputation: 40
Default Re: Pawn.Regex - full support of regular expressions

Good job!
Barnwell is offline   Reply With Quote
Old 24/03/2018, 01:19 PM   #24
YourShadow
Big Clucker
 
YourShadow's Avatar
 
Join Date: Apr 2016
Posts: 118
Reputation: 232
Default Re: Pawn.Regex - full support of regular expressions

Updated.

1.1.2:
- Changed naming conventions
- Added pawn.json
- Improved OnPlayerCommandText example
YourShadow is offline   Reply With Quote
Old 25/03/2018, 10:05 AM   #25
sampkinq
Big Clucker
 
Join Date: Sep 2013
Location: Turkey
Posts: 177
Reputation: 6
Default Re: Pawn.Regex - full support of regular expressions

How can I block IP advertisements using this?
sampkinq is offline   Reply With Quote
Old 25/03/2018, 10:18 AM   #26
Kaperstone
High-roller
 
Kaperstone's Avatar
 
Join Date: May 2011
Location: Russia
Posts: 3,353
Reputation: 822
Default Re: Pawn.Regex - full support of regular expressions

Quote:
Originally Posted by sampkinq View Post
How can I block IP advertisements using this?
I hope you understand that you cannot completely eliminate the issue with this plugin, you can avoid most of it, but people will still find innovative ways to advertise.


As for the code, learn how to use Regex.
__________________
Kaperstone is offline   Reply With Quote
Old 29/03/2018, 05:40 AM   #27
Kar
High-roller
 
Kar's Avatar
 
Join Date: May 2010
Location: Black Asylum
Posts: 3,211
Reputation: 497
Default Re: Pawn.Regex - full support of regular expressions

Is this correct usage of this plugin's functions?

Code:
#if defined _pawnregex_included
regex_IsValidIP(const string[])
{
	// = \\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)+([(/|,.)?\\s]{1,})+(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)+([(/|,.)?\\s]{1,})+(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)+([(/|,.)?\\s]{1,})+(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b //  Pooh7's second
	// = ([0-9\\s]{1,})+([(\/|_,.)?\\s]{1,})+([0-9\\s]{1,})+([(\/|_,.)?\\s]{1,})+([0-9\\s]{1,})+([(\/|_,.)?\\s]{1,})+([0-9\\s]{1,}) Pooh7's
	// = (.*?)([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})(.*?)
	// = ((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([\s\.\$]+)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\s*:\s*[0-9]+)?

	new
		result,
		regex:ipRegex = Regex_New("((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([\s\.\$\,\_\-\@\!\#\+\=\<\>]+)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\s*:\s*[0-9]+)??");
	result = Regex_Check(string, ipRegex);
	Regex_Delete(ipRegex);
	return result;
}
#endif
Kar is offline   Reply With Quote
Old 29/03/2018, 08:01 AM   #28
Evocator
Huge Clucker
 
Join Date: Nov 2013
Posts: 481
Reputation: 153
Default Re: Pawn.Regex - full support of regular expressions

Yep.
Evocator is offline   Reply With Quote
Old 30/03/2018, 02:08 PM   #29
Kaperstone
High-roller
 
Kaperstone's Avatar
 
Join Date: May 2011
Location: Russia
Posts: 3,353
Reputation: 822
Default Re: Pawn.Regex - full support of regular expressions

Quote:
Originally Posted by Kar View Post
Is this correct usage of this plugin's functions?

Code:
#if defined _pawnregex_included
regex_IsValidIP(const string[])
{
	// = \\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)+([(/|,.)?\\s]{1,})+(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)+([(/|,.)?\\s]{1,})+(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)+([(/|,.)?\\s]{1,})+(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b //  Pooh7's second
	// = ([0-9\\s]{1,})+([(\/|_,.)?\\s]{1,})+([0-9\\s]{1,})+([(\/|_,.)?\\s]{1,})+([0-9\\s]{1,})+([(\/|_,.)?\\s]{1,})+([0-9\\s]{1,}) Pooh7's
	// = (.*?)([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})(.*?)
	// = ((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([\s\.\$]+)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\s*:\s*[0-9]+)?

	new
		result,
		regex:ipRegex = Regex_New("((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([\s\.\$\,\_\-\@\!\#\+\=\<\>]+)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\s*:\s*[0-9]+)??");
	result = Regex_Check(string, ipRegex);
	Regex_Delete(ipRegex);
	return result;
}
#endif
No, you'd need to escape once more the escapes.

The first escape should be for regex, if you leave it that way, you're escaping the chars in Pawn and it will send the regex without the escapes \
The second escape will escape from making the escapes disappear \\ and it will send the regex query with the escape \ and will work fine.

In other words, the first for pawn, the second for regex.
__________________
Kaperstone is offline   Reply With Quote
Old 14/04/2018, 07:39 AM   #30
YourShadow
Big Clucker
 
YourShadow's Avatar
 
Join Date: Apr 2016
Posts: 118
Reputation: 232
Default Re: Pawn.Regex - full support of regular expressions

IsPasswordCorrect(szPassword[])
{
static Regex:rPASS;

if(!rPASS) rPASS = Regex_New("^[[email protected]#\\$%\\^&*()_+-\\[\\];\\\\<>,\\.\\/?`~\"]{5,30}+$");

return Regex_Check(szPassword, rPASS);
}
YourShadow is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] Regular Expressions Plugin v0.2 (RegEx) Koala818 Plugin Development 22 09/09/2016 07:36 AM
[Tutorial] Converting to ALS 4 (Hook Method 7) Very Quickly With Regular Expressions [HLF]Southclaw Tutorials 1 29/07/2014 08:12 PM
Need help and full support monkuttan Server Support 33 16/11/2013 02:35 PM
expressions string to expressions? iJumbo Scripting Help 9 05/05/2013 12:56 AM
[REGEX] Acceptable nickname regular expression ikkentim Scripting Help 1 29/01/2013 08:13 PM


All times are GMT. The time now is 06:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.