fork(1) download
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		String line = "aluno/1/Teste dos Testes/1,2,33,3,4";
		String line2 = "aluno/1/Teste dos Testes/1,2,33,3,4a";
		String line3 = "aluno/1/Teste dos Testes/1,2,33,3,a";
		String line4 = "aluno/1/Teste dos Testes/1,2,33a,3";
		String pattern = "(\\/[\\d,]+\\d)$";
		
		Pattern r = Pattern.compile(pattern);
		
		Matcher i = r.matcher(line);
		Matcher i2 = r.matcher(line2);
		Matcher i3 = r.matcher(line3);
		Matcher i4 = r.matcher(line4);

		if (i.find( )) {
			System.out.println("OK!");
			System.out.println("Valor encontrado: " + i.group(0) );
		}else{
			System.out.println("Inválido");
		}

		if (i2.find( )) {
			System.out.println("OK!");
		}else{
			System.out.println("Inválido");
		}

		if (i3.find( )) {
			System.out.println("OK!");
		}else{
			System.out.println("Inválido");
		}

		if (i4.find( )) {
			System.out.println("OK!");
		}else{
			System.out.println("Inválido");
		}
	}


}
Success #stdin #stdout 0.1s 28096KB
stdin
Standard input is empty
stdout
OK!
Valor encontrado: /1,2,33,3,4
Inválido
Inválido
Inválido