tags:

views:

19

answers:

1

Hi guys!

I've got the following strings:

Showname  
Showname - with hyphen  
Showname - Season 4 

What I want is:

Showname     
Showname - with hyphen
Showname

What I've come up with so far is:

/(.*)( - season /d/d?)/i

But that requires - season ?? to be in the string, which is not always the case...

Any help would be really appreciated!

Cheers,
Roy

+3  A: 

basically, you want to strip off the season?

do a regex replace on

/ - season \d+$/i

and replace it with an empty string.

if the season isn't in there, nothing will get replaced and the original string will be returned.

Mark
Gah! Thanks! Never thought about that! Your the best ;)
SilverViper