[Plugin] Regular expression
#21

http://www.regular-expressions.info/reference.html
Reply
#22

So its not possible to check for more latters
Reply
#23

Isnt this right?

Copied from the link by BalckLite
Quote:

[a-zA-Z0-9] matches any letter or digit

Reply
#24

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]")
Reply
#25

Yes, i did but i got bad english and dont understand everything what is standing there
Reply
#26

You may read a tutorial first, references are typically not very good for learning if you're a beginner
Reply
#27

Quote:

i did but i got bad english and dont understand everything what is standing there

That ^
Reply
#28

Is it that hard to find another one which is written in your native language?
Reply
#29

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
Reply
#30

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.

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
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.
Reply
#31

Hi! Nice work!
Can you give me an example for anti advertising for sites ,ip,dns?
Reply
#32

Quote:
Originally Posted by songoku11
Посмотреть сообщение
Hi! Nice work!
Can you give me an example for anti advertising for sites ,ip,dns?
****** posted a clever regex to match web addresses earlier in this thread:

Код:
([\w-]*://)?([\w-]+\.)+([\w-]+)(/[^\s]*)*
I am aware that the link I posted earlier in this thread was a "Reference" page aimed at people who have some experienced with regex, however that same site is full of other info useful for any skill level. See the examples page here (includes a regex for IP addresses):

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
Reply
#33

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.
Reply
#34

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 ==========
Reply
#35

Awwww nice
Reply
#36

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
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 ==========
I don't know how to fix it in VS10. Use VS9 =)
Reply
#37

I hope I can use vs9 side by side with vs10 (?)
Reply
#38

Quote:
Originally Posted by gamer_Z
Посмотреть сообщение
I hope I can use vs9 side by side with vs10 (?)
Yes =)
Reply
#39

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
Reply
#40

#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?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)