Jump to content

PregMatch REGEX problem


sup

Recommended Posts

I have the following lines in an array

 

Sten1986 folds
Denis2391 folds
hesims raises to $1
Raphaln123 folds
Southlander calls $0.90
d3dsheep raises to $3.75

 

I want to extract their action. So it's either call , fold, or raise

 

So I made this:

/d3dsheep (.*?) /

 

This returns me 'raises', which is perfect.

 

But when some1 folds, there is no Space at the end, so dont get the Fold actions.

 

Can some1 tell me what to change about my regex to get FOLDS and Raises/calls?

Link to comment
Share on other sites

try

<?php 
$test = 'Sten1986 folds
Denis2391 folds
hesims raises to $1
Raphaln123 folds
Southlander calls $0.90
d3dsheep raises to $3.75';
preg_match('/Southlander (folds|raises|calls)/', $test, $out);
print_r($out[1]);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.