My regex kung-fu is not strong =(

Discussion in 'PHP' started by Handler, Apr 4, 2020.

  1. Handler


    Apr 4, 2020
    Likes Received:

    I'm trying to stumble by getting a pattern match. Now, I can get once instance of how it could be it's the second that I'm not really wrapping my head around.

    Here's my test text :
    I'm using this regex:
    preg_match_all('/Payment method:\W+(.+)/m', $input_lines, $output_array);

    I got the first 'Visa-1447' what I'm having the trouble is capturing the lower one that has two payment methods with the dollar amount after them!

    Don't know what's frustrating me more; figuring this out or being kept hostage inside cause of this pandemic thing! :mad:

    So if you could help me out I'd appreciate it! But I ask one thing so I can understand and absorb is tell me the how and why!

    Thank you way in advance!

    Handler, Apr 4, 2020
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.