Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

Need assistance to fix this regex

  •  04-01-2010, 7:22 PM

    Need assistance to fix this regex

    I'm trying to get a regex expression that fills in 4 pieces of information for me.

    1) Series, in this case Formula1

    2) Year, in this case 2010

    3) Venue, in this case Grand Prix

    4) Tag, in this case:  Grand.Prix.WS.PDTV.XviD-433 2

    I have a regex expression in the snippet of the bash file below, bit it is not generating any of those 4 tags as I was hoping. Any help would be much appreciated. 

     

    Example of file being looked at by Regex

    Formula1.2010.Australian.Grand.Prix.WS.PDTV.XviD-433 2.avi

     

    Regex code and bash remap section of code:

     

    # regex expression parse Tag information from the filename

    regex="^([a-zA-Z]+)\.(20[0-9][0-9])\.([a-zA-Z]+)\.(.*)$"

     

    if [[ $CATEGORY -eq "tv" && $NAME =~ $regex ]]; then

      show_name=${BASH_REMATCH[1]}

      season=${BASH_REMATCH[2]}

      episode_name=${BASH_REMATCH[3]}

      tag=${BASH_REMATCH[4]}

    fi 

View Complete Thread