Spring Posted February 23, 2011 Share Posted February 23, 2011 If I had the pattern: $pattern = "/^[a-zA-Z0-9._-]{4,20}$/"; And I wanted to replace, 4, 20 with a variable, how would I go about doing so? Quote Link to comment Share on other sites More sharing options...
silkfire Posted February 23, 2011 Share Posted February 23, 2011 Like this?: $var = '5,19'; $pattern = '/^[a-zA-Z0-9._-]{' . $var . '}$/'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.