Regex letters, numbers and underscores
#1
Hello,
Could anyone help me with mycode regex. It should only allow: letters, numbers and underscores, so:
a-z, A-Z, 0-9, _

At the moment I'm using this:
\[test\](.*?)\[/test\]
Reply
#2
This user has been denied support. This user has been denied support.
\w is the letters, numbers and underscore expression.
so that would be,
\[test\](\w+)\[/test\] 
Beep Boop          
                                          ~ RIP Server 2014-2014
Reply
#3
Thanks, can you limit the number of characters as well?

@Edit:
\[test\](\w{2,20})\[/test\] 

Would that be correct?
Reply
#4
Try this:

\[test\]([\w]{2,20})\[/test\]

The pattern you posted would match too, but I personally prefer to wrap my capture groups for readability.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)