-2

I'm working on a code in php, and I want to work with regular expressions so this is the file I have

(1) DF  Mikael Nilsson                     ##   27, Panathinaikos (GRE)
(3)  DF  Olof Mellberg                      ##   64, Aston Villa (ENG)

So I have made myself a regular expression that is this one #\W[A-Z]{3}\S# but the outcome is (ENG) and I want the outcome te be only ENG and GRE so only the text inside the parentheses.

I hope there is someone who can help me, Thanks for the afford

mr13018
  • 17
  • 5
  • Simply put grouping parentheses around the inner part: `#\W([A-Z]{3})\S#`, then you will get an extra entry in your array of matches with only the contents inside. – CBroe Dec 29 '14 at 19:49
  • @CBroe this still select the parentheses.. – mr13018 Dec 29 '14 at 19:51
  • 1
    As I said, yes – you will get the _whole_ match first, but the _inner_ match as a separate value (extra entry in the resulting array). – CBroe Dec 29 '14 at 20:15
  • @CBroe Oke! Thank you it worked as you told me – mr13018 Dec 30 '14 at 08:07

1 Answers1

1
(?:\()([A-Z]{3})(?:\))

When matching that, you should capture a group from it, which is only the letters.