Regular expression problem (extracting one text or another)

I have problem with regex. I've been playing with it for three hours and I didn't find out anything working.

I have this text:

Fax received from 45444849 ( 61282370000 )

And I need to extract the number from brackets, so I will get 61282370000. If there is nothing (or whitespaces only) in brackets it should take the number before brackets. I have only managed to do this expression, which takes the number from brackets correctly:

Fax received from .* \(\s([^)]*)\s\)$

Thanks.

6
задан manji 10 May 2011 в 09:18
поделиться