PAC-2 UF 5 (EXPRESIONES)
![]() |
![]() |
![]() |
Título del Test:![]() PAC-2 UF 5 (EXPRESIONES) Descripción: PROGRAMACION |




Comentarios |
---|
NO HAY REGISTROS |
Completa los huecos del siguiente código referente a la manipulación de expresiones regulares de búsqueda. Se debe distinguir entre mayúsculas y minúsculas. import java.util.regex.*; public class EjemploReplaceAll{ public static void main(String args[]){ ....(1)......= Pattern. ......(2)........("bbcc"); Matcher encaja = patron. .......(3)............. ("bbccmaabbccnoloaabbccbmanoloabmolob"); String resultado = encaja.replaceAll(".."); System.out.println(resultado); } }. 1 OPCION. 2 OPCION. 3 OPCION. Selecciona si es correcto o incorrecto las siguientes dos sentencias de código: Patter patron = Patter.compile ("pedro"); Macher encaja = patron.match();. VERDADERO. FALSO. Completa los huecos del siguiente código de forma que compruebe si el String cadena contiene exactamente el patrón (matches) “abc”. Se debe distinguir entre mayúsculas y minúsculas. Pattern pat = ...(1)... . ...(2)... ("abc"); ...(3)........... mat = pat.matcher(cadena); if (mat.matches()) { System.out.println("SI"); } else { System.out.println("NO"); }. 1 OPCION. 2 OPCION. 3 OPCION. Completa los huecos del siguiente código de forma que compruebe si el String cadena solo contienen los caracteres a ó b. Se debe distinguir entre mayúsculas y minúsculas. Pattern pat = ....(1)..... .compile("(.........(2)........ )+"); ......(3)....... mat = pat.matcher(cadena); if (mat.matches()) { System.out.println("SI"); } else { System.out.println(“NO"); }. 1 OPCION. 2 OPCION. 3 OPCION. |