Documentos de Académico
Documentos de Profesional
Documentos de Cultura
MATERIA:
LENGUAJES AUTOMATAS
TRABAJO:
EXPRESIONES REGULARES
CATEDRATICO:
ING. JOSE ALFREDO ROMAN CRUZ
ELABARO:
LPEZ PREZ BERTN
REYES ORTIZ RAYMUNDO
RUIZ HERAZ RENE
CARRERA:
ISC
SEMESTRE:
6
GRUPO:
6US
Abcde
Ababcdede
Abababcde
Abcdedede
Abcdede
abababcde
Expresin regular:
L= a (b|c)* (de)+ f (ef)+
0101
01
000
010101
01010101
0000
00000
Expresin regular:
L= (ab)+ cd (bcd)+ e (cde)+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package automata1;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author
*/
public class Automata1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String cad;
System.out.print("Introduce cadena: ");
cad = sc.nextLine();
Pattern pat = Pattern.compile("^(?:\\+|-)?\\d+$");
Matcher mat = pat.matcher(cad);
if(mat.find()){
System.out.println("Cadena Vlido");
}else{
System.out.println("Cadena No Vlido");
}
}
}