matak
11-07-2007, 02:47 PM
Learning regex, and i have stumbled on this..
* quantifier matches 0 or more times. is this normal to be true or false
preg_match ("/tras*hformers/" , "trashforsmers"); // FALSE (tutorial says it should be true
preg_match ("/tras*hformers/" , "trashformersss"); // TRUE
i'm wondering couse i found one tutorial, and now when i test it looks like it's wrong.
i guess the whole pattern must be true AND then after the pattern if any 's' were found it will also be true..
thanks
* quantifier matches 0 or more times. is this normal to be true or false
preg_match ("/tras*hformers/" , "trashforsmers"); // FALSE (tutorial says it should be true
preg_match ("/tras*hformers/" , "trashformersss"); // TRUE
i'm wondering couse i found one tutorial, and now when i test it looks like it's wrong.
i guess the whole pattern must be true AND then after the pattern if any 's' were found it will also be true..
thanks