scs Posted August 15, 2006 Share Posted August 15, 2006 I looked at some tutorials and im always getting an error. here is what I have right now.preg_match('dfgdfg d662dg d6dfggd', '/^[a-zA-Z0-9] [a-zA-Z0-9] [a-zA-Z0-9]$/', $return);Its just a test. let me explain what Im trying to do.In this text file there is 3 pieces of text, include numbers. like sodfgdfg d662dg d6fghgddfgdfg d662dg d6456gddfsfgfg d662dg d6dfggdWhen I read the file I read it line by line. so I can work with each one at a time. I need to split the line in to 3 pieces using the spaces inbetween them.can anyone find what im doing wrong. oh yeah, here is the error I get:Warning: preg_match(): Delimiter must not be alphanumeric or backslashthanxzach Link to comment https://forums.phpfreaks.com/topic/17675-getting-3-parts-of-a-string/ Share on other sites More sharing options...
effigy Posted August 15, 2006 Share Posted August 15, 2006 Character classes [tt][...][/tt] only specify [u]one[/u] instance. Quantifiers need to be applied in order to look for more. You also have your regex and string in the wrong places. In this case, you're using the wrong tool for the job. Look at the explode function. Link to comment https://forums.phpfreaks.com/topic/17675-getting-3-parts-of-a-string/#findComment-75322 Share on other sites More sharing options...
scs Posted August 15, 2006 Author Share Posted August 15, 2006 oh ok. Thanks! Link to comment https://forums.phpfreaks.com/topic/17675-getting-3-parts-of-a-string/#findComment-75323 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.