Regex Patterns
I'm trying to learn Regex patterns because I have seen them to be more useful than trying to make a function to check.
Let's say I wanted to check if the given string was a SteamID. Would this work: ^STEAM_0:(0|1):\d$ |
Re: Regex Patterns
It would not work, because you're only allowing for one digit after the second colon.
Something like this, maybe: ^STEAM_0:(?:0|1):\d{1,16}$ I'm not sure what the maximum length of the number after the second colon may be. I added "?:" so it won't save the number after the first colon. |
Re: Regex Patterns
What about :
(?i:STEAM)_0:(0|1):\d+ -> case insensitive + infinite number + check if contained into the string or ^(?i:STEAM)_0:(0|1):\d+$ -> case insensitive + infinite number + the string must be exact |
Re: Regex Patterns
@stupok
I guess I misunderstood \d because I thought it meant that it could be any number of digits, not just 1. @joaquimandrade However, that program is not free, and I do not find it necessary to buy. @arkshine Thanks! EDIT: When I use this: ^STEAM_0:(0|1):\d+$ And I test with: STEAM_0:1:2345 I get these matches: STEAM_0:1:2345 1 Is that normal? EDIT 2: Nevermind. I did some testing and it always returns that, even with a plugin I made to test. |
Re: Regex Patterns
@arkshine
What is ?i: ? |
Re: Regex Patterns
Quote:
|
Re: Regex Patterns
?i works? what the hell!
|
| All times are GMT -4. The time now is 16:53. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.