|
NOTA: La traducción de esta documentación es un esfuerzo personal y voluntario, no es un documento oficial de Sun Microsystems
ni Oracle ni está patrocinado por ninguna de estas empresas. Los documentos originales (en inglés) están disponibles en:
http://java.sun.com/docs/books/tutorial/.
Dirija cualquier comentario, petición, felicitación, etc. a tutorialesjava_@RROBA_codexion.com. |
Si desea ayudar a mantener en funcionamiento esta web, colaborar con la traducción de estos documentos o necesita que se traduzca algĂșn capĂtulo en concreto puede realizar una donación directa mediante Paypal:
|
Questions
- What are the three public classes in the
java.util.regexpackage? Describe the purpose of each.- Consider the string literal
"foo". What is the start index? What is the end index? Explain what these numbers mean.- What is the difference between an ordinary character and a metacharacter? Give an example of each.
- How do you force a metacharacter to act like an ordinary character?
- What do you call a set of characters enclosed in square brackets? What is it for?
- Here are three predefined character classes:
\d,\s, and\w. Describe each one, and rewrite it using square brackets.- For each of
\d,\s, and\w, write two simple expressions that match the opposite set of characters.- Consider the regular expression
(dog){3}. Identify the two subexpressions. What string does the expression match?
Exercises
- Use a backreference to write an expression that will match a person's name only if that person's first name and last name are the same.