Jump to content

preg_match function


Heero

Recommended Posts

Hi all,

 

I was using the preg_match function like this:

 

echo preg_match("//i", "\"Yes\"");

 

And this turns out to return 1 indicating that there is a match...but it's not what I want.  If the string is empty then it shouldn't be returning true for a match with the string Yes..

 

I was wondering whether there were any other modifiers like the /i modifier that could solve this problem?

 

I could use an if statement to first check if the string was empty, but that seems pointless.

 

Any suggestions?

 

 

Link to comment
https://forums.phpfreaks.com/topic/49159-preg_match-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.