Jump to content

Simple Regex Expression


Eggzorcist

Recommended Posts

Is it possible using the limiters {} to show only the minimum requirement with no maximum requirement.

 

if(filter_var($message, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>"/{7}/"))) === false){
echo $error['message'] = "ERROR";	
}

 

I get an error with this, and without the backslashes too... Any other ways?

 

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/217949-simple-regex-expression/
Share on other sites

{...} is a range quantifier. Example:

 

{n} n occurrences exactly

{n,} At least n occurrences

{,m} At most m occurrences

{n,m} Between n and m occurrences

 

What your pattern says is..."match exactly 7 of...."  except you aren't actually matching for anything in that pattern.  Please explain what it is you are actually trying to match.

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.