Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Regular Expression within an IF statement.

I was wondering if I could use reg-expression within an IF statement, like so...


while($file[$i] = readdir($dp3))
    if($file[$i] != '.' && $file[$i] != '..' && $file[$i] != 'dsc_[\s\S]*?.jpg')
            { echo $file[$i]; }
}


The reg-ex im using is
 dsc_[\s\S]*?.jpg


It's not working for me, is it possible? If not I need some code to get the same result.
TIA
0
bertmn
Asked:
bertmn
1 Solution
 
RoonaanCommented:
if($file[$i] != '.'&& $file[$i] != '..'&& !preg_match('/^dsc_(.*)\.jpg$/i', $file[$i])) {

-r-
0
 
bertmnAuthor Commented:
Thanks Roonaan :)
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now