3raser Posted June 3, 2012 Share Posted June 3, 2012 I've decided that knowing a good portion of Regex is a necessity. Sadly, starting out always seems to be the hardest. In the following expression, I attempt to match anything that starts with . Like so: /\[quote=[a-zA-Z0-9]\]/g So for instance, I'd like for it to match something like this: [quote=bob] Any reasons why it doesn't seem to work? Thanks. Link to comment https://forums.phpfreaks.com/topic/263566-my-start-to-regex/ Share on other sites More sharing options...
Pikachu2000 Posted June 3, 2012 Share Posted June 3, 2012 Tags were all hosed. Fixed that for ya. Link to comment https://forums.phpfreaks.com/topic/263566-my-start-to-regex/#findComment-1350730 Share on other sites More sharing options...
3raser Posted June 3, 2012 Author Share Posted June 3, 2012 Thank you. Link to comment https://forums.phpfreaks.com/topic/263566-my-start-to-regex/#findComment-1350732 Share on other sites More sharing options...
requinix Posted June 3, 2012 Share Posted June 3, 2012 [a-zA-Z0-9] By itself that means only one. It would work with quote=b. Add a "quantifier" to it - which one depends on what you want to allow. Link to comment https://forums.phpfreaks.com/topic/263566-my-start-to-regex/#findComment-1350742 Share on other sites More sharing options...
3raser Posted June 3, 2012 Author Share Posted June 3, 2012 [a-zA-Z0-9] By itself that means only one. It would work with quote=b. Add a "quantifier" to it - which one depends on what you want to allow. I'm not looking for just quote=b. :/ I'm looking for [tt] [tt] Link to comment https://forums.phpfreaks.com/topic/263566-my-start-to-regex/#findComment-1350746 Share on other sites More sharing options...
requinix Posted June 3, 2012 Share Posted June 3, 2012 [a-zA-Z0-9] By itself that means only one. It would work with quote=b. Add a "quantifier" to it - which one depends on what you want to allow. I'm not looking for just quote=b. :/ I'm looking for [tt] [tt] Right. Which is why you should add a quantifier. Link to comment https://forums.phpfreaks.com/topic/263566-my-start-to-regex/#findComment-1350749 Share on other sites More sharing options...
3raser Posted June 3, 2012 Author Share Posted June 3, 2012 Ah hah, I got it working. \[quote=[a-zA-Z0-9]+\] Link to comment https://forums.phpfreaks.com/topic/263566-my-start-to-regex/#findComment-1350756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.