kts Posted April 3, 2008 Share Posted April 3, 2008 I have a variable that contains ## or ##_## or ##_##_## I would like to use regex to grab out if its ##_## grab both nums and define which is first and second as well as the third ##_##_## 1, 2, 3 in seperate variables or an array is this possible? Quote Link to comment Share on other sites More sharing options...
Paperstyle Posted April 4, 2008 Share Posted April 4, 2008 You'd use preg_split, with a pattern something like /\D/ so you're splitting by non-digits. Or if there'll always be underscores separating the numbers you could use explode($yourString, '_'). 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.