racken Posted January 15, 2013 Share Posted January 15, 2013 (edited) I'm trying to make some regex that will find all the cases of words which start with a : I have (:[a-zA-Z]) which just finds the first letter atm I've no idea how to find the whole word For an example string SELECT * , u.nick FROM webid_useraccounts LEFT JOIN webid_users u ON (u.id = webid_useraccounts.user_id) WHERE user_id = :user_id ORDER BY date LIMIT :OFFSET , :perpage it would return :user_id, :OFFSET and :perpage EDIT: nvm I was just being thick I missed the *. It should of been (:[a-zA-Z]*) Edited January 15, 2013 by racken Quote Link to comment https://forums.phpfreaks.com/topic/273190-match-this-that-in-a-string/ Share on other sites More sharing options...
Christian F. Posted January 15, 2013 Share Posted January 15, 2013 Actually, that will find all semi-colons, whether or not they have a letter following them. You'll want to use + instead of *, to enforce at least 1 character after the semi-colon. Quote Link to comment https://forums.phpfreaks.com/topic/273190-match-this-that-in-a-string/#findComment-1405863 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.