php - How to join N regex patterns into one -


i have few patters these:

    $confirm    = '~/[a-z][a-z]/confirm\?hash=[0-9a-za-z]+~u';     $letter = '~/[a-z][a-z]/letter/[0-9a-za-z]+~u';     $tracker   = '~/[a-z][a-z]/(tracker\?hash)=[0-9a-za-z]+~u';     preg_match($confirm, $text); 

they work fine.

how can join these 3 patterns one? have tried | conditional, it's not working.

i need like:

preg_match ($confirm or $letter or $tracker, $text) if match found ok 

you try put 3 patterns one:

$pattern = '~/[a-z][a-z]/(confirm\?hash=|letter|tracker\?hash=)[0-9a-za-z]+~u'; preg_match($pattern, $text); 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -