Welcome visitor
* Login
* Register
It is currently March 24th, 2019, 12:55 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Server Side » PHP



Post new topic Reply to topic  [ 3 posts ] 
Author Message
  Tricky string validation
PostPosted: February 18th, 2009, 9:42 pm 

Posts: 26
Hi, I think this is an easy one, but I'm a little confused by now... What I want to do is to validate a string 3 times before using it. For example, it should have the word "a", then anything but "b" and finally it should have the word "c", so
a d c -->would be true
a d b c -->would be false
b a c -->would be false because it contains b
a d e-->would be false because the c is missing

sorry if this is confusing and thanks for the help.


Top
 Profile  
 
  Re: Tricky string validation
PostPosted: February 18th, 2009, 9:45 pm 
User avatar

Posts: 79
i would use stripos strpos and then compare the values, btw, according to your example it doesnt matter if the -b- is before or after the -a- so the only thing you need to validate is if the -a- and -c- are present and the -b- is missing. i think you can figure out the rest.


Top
 Profile  
 
  Re: Tricky string validation
PostPosted: February 18th, 2009, 9:46 pm 

Posts: 26
Yes, I really appreciate it, thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

FORUMS » Server Side » PHP


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron