08.05.2011, 21:16
[Plugin] Regular expression
09.05.2011, 12:39
So its not possible to check for more latters
09.05.2011, 12:55
Isnt this right?
Copied from the link by BalckLite
Copied from the link by BalckLite
Quote:
[a-zA-Z0-9] matches any letter or digit |
09.05.2011, 13:15
I dont get it, i also read here
Code:
"[a-z]" Lower case letters "[A-Z]" Upper case letters "[0-9]" Digits
pawn Code:
#define IsValidText(%1) regex_match(%1, "[a-zA-Z0-9]")
#define IsNumber(%1) regex_match(%1, "[0-9]")
09.05.2011, 13:29
Yes, i did but i got bad english and dont understand everything what is standing there
09.05.2011, 13:44
You may read a tutorial first, references are typically not very good for learning if you're a beginner
09.05.2011, 13:47
Quote:
i did but i got bad english and dont understand everything what is standing there |
09.05.2011, 13:51
Is it that hard to find another one which is written in your native language?
09.05.2011, 13:54
There is no good tutorials in my language!
wow we have soon spent a wole page on
"Did you read the page"
"Yes"
"Read a tutorial"
"i already did"
lol -.-
nvm then, ill do it on another way! because it looks like nobody want to help me
wow we have soon spent a wole page on
"Did you read the page"
"Yes"
"Read a tutorial"
"i already did"
lol -.-
nvm then, ill do it on another way! because it looks like nobody want to help me
13.05.2011, 06:58
(
Last edited by HP; 14/05/2011 at 03:58 PM.
)
I'm new to regular expressions, but might defining the amount of letters or numbers in "regex_match" fix Unknown123's problem? I'm assuming that if there isn't defined the number or characters, the default value is 1(one), so it will check for 1 character. I'm not sure about this, but maybe this will fix it? I might actually start reading more about it, when I get back home.
You can also leave the second number blank, so it well set only the minimal ammount of letters - {3, }. Just take a look at the examples brought out over here.
There is pretty much everything explained in the first post, but as I'm new to this, I don't know much about Regular Expressions. I'll learn it as soon as I have some time.
pawn Code:
#define IsValidText(%1) regex_match(%1, "[a-zA-Z0-9]{1,3}") // Minimal amount of characters is 1 and maximum of all is 3
// You can also check the length of the characters separated, if you want any number or letters to be in a specific length
#define IsNumber(%1) regex_match(%1, "[0-9]{2,4}") // Minimal amount of numbers is 2 and maximum of all is 4
There is pretty much everything explained in the first post, but as I'm new to this, I don't know much about Regular Expressions. I'll learn it as soon as I have some time.
18.05.2011, 17:32
Hi! Nice work!
Can you give me an example for anti advertising for sites ,ip,dns?
Can you give me an example for anti advertising for sites ,ip,dns?
19.05.2011, 03:33
Quote:
Hi! Nice work!
Can you give me an example for anti advertising for sites ,ip,dns? |
Код:
([\w-]*://)?([\w-]+\.)+([\w-]+)(/[^\s]*)*
http://www.regular-expressions.info/examples.html
If you're completely new to regex you might want to start here:
http://www.regular-expressions.info/tutorial.html
26.05.2011, 10:36
I was going to post earlier, but never got around to it. Thank you very much for this plugin, it's brilliant, and has meant I've been able to recode some functions in my script, to be faster, and use a lot less code. Thank you for this.
08.06.2011, 09:24
how did you compile this project? (ByTheWay I had to disable the precompiled headers that were enabled in your project, I do not have them?)
Код:
1>------ Rebuild All started: Project: regex, Configuration: Debug Win32 ------ 1> main.cpp 1>c:\users\rafal\documents\visual studio 2010\projects\regex_source_2_0\sdk\amx\amx.h(60): error C2371: 'int32_t' : redefinition; different basic types 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdint.h(19) : see declaration of 'int32_t' 1>c:\users\rafal\documents\visual studio 2010\projects\regex_source_2_0\sdk\amx\amx.h(61): error C2371: 'uint32_t' : redefinition; different basic types 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdint.h(23) : see declaration of 'uint32_t' 1> amxplugin.cpp 1> Generating Code... ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
08.06.2011, 09:28
Awwww nice
08.06.2011, 12:46
Quote:
how did you compile this project? (ByTheWay I had to disable the precompiled headers that were enabled in your project, I do not have them?)
Код:
1>------ Rebuild All started: Project: regex, Configuration: Debug Win32 ------ 1> main.cpp 1>c:\users\rafal\documents\visual studio 2010\projects\regex_source_2_0\sdk\amx\amx.h(60): error C2371: 'int32_t' : redefinition; different basic types 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdint.h(19) : see declaration of 'int32_t' 1>c:\users\rafal\documents\visual studio 2010\projects\regex_source_2_0\sdk\amx\amx.h(61): error C2371: 'uint32_t' : redefinition; different basic types 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdint.h(23) : see declaration of 'uint32_t' 1> amxplugin.cpp 1> Generating Code... ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== |
08.06.2011, 13:49
I hope I can use vs9 side by side with vs10 (?)
08.06.2011, 14:05
08.06.2011, 14:30
Okay it works, thanks for the solution
Now I can try to make my StringReplace (and maybe a stringLibrary) plugin
Actually I have one plugin but it is slower than pawn str_replace xD
Now I can try to make my StringReplace (and maybe a stringLibrary) plugin
Actually I have one plugin but it is slower than pawn str_replace xD
08.06.2011, 15:10
#define IsValidRpName(%1) \
regex_match(%1, "([A-Z]{1,1})[a-z]{2,9}+_([A-Z]{1,1})[a-z]{2,9}")
Would check only for _ or letters too?
I mean:
TesT_TeST would return 1 or 0?
regex_match(%1, "([A-Z]{1,1})[a-z]{2,9}+_([A-Z]{1,1})[a-z]{2,9}")
Would check only for _ or letters too?
I mean:
TesT_TeST would return 1 or 0?
« Next Oldest | Next Newest »
Users browsing this thread: 2 Guest(s)