dongwei6700 2017-07-25 10:27
浏览 35
已采纳

来自String的最后一个大写字

I want uppercase word from string

WORDA - WORDB - WORDC - Failure occurring to be verified if a WORDD WORDE is linked to the failure.

the expected output i want for above string is like this :

WORDD WORDE

  • 写回答

1条回答 默认 最新

  • dopii22884 2017-07-25 10:55
    关注

    try :

    <?php
    $a= "WORDA - WORDB - WORDC - Failure occurring to be verified if a WORDD WORDE is linked to the failure.";
    $b= '/([A-Z|\s\0-9]+)[a-z|\W\|0-9]*$/';
    preg_match($b, $a, $c, PREG_OFFSET_CAPTURE);
    print_r($c[1][0]);
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?