1 2 3 Previous Next 30 Replies Latest reply: Oct 3, 2010 11:49 AM by asarkar RSS

    Suggest one regex to match all the following CharSequence

    asarkar
      Hi,
      I am looking for a regex to match all the following CharSequence and extract 2 groups out of 'em. The first group would be the name without the 4-digit year and parentheses. The second group, if present, would be the 4-digit year without the parentheses.
      abc.avi
      Ab-C.mkv
      abc def.mkv
      AbC DeF.divx
      abc (2010).avi
      ABC-DEF (2010).mkv

      One I came up with does not work as expected:
      ([\\w\u2212\u0020]+?)[\\((\\d{4}+)\\)]{1}?[\\.[avi]|[mkv]|[mp4]|[divx]]{1}?
      Any help would be appreciated.
      --
      Abhi

      Edited: Added code formatting
        1 2 3 Previous Next