Docsity

Expresiones Regulares, Diapositivas de Algoritmos y Programación

Vista previa parcial del texto

¡Descarga Expresiones Regulares y más Diapositivas en PDF de Algoritmos y Programación solo en Docsity!

REGULAR EXPRESSION

Members:

1. Alcibiades Lopez

2. Steven Cabarcas

3. Jesith Galvis

1. What is a regular expression?

Regular expressions (often called RegExp or RegEx)
are a formula for finding certain matches within a
string of characters, that is, patterns that allow a
text search.
3. How is the syntax for a regular expression that
only allows letters and digits and the underscore
character?

The syntax of a regular expression that only allows letters and digits and the underscore character can be seen as follows:

^[a-zA-Z0-9_]+$

^[a-zA-Z0-9_]+$

In this case, the string starts with the ^ symbol. Ensures that the string starts with the allowed characters.

Brackets define the hyphenated character set that allows letters, digits, and underscores.

The + sign tells us that the set of allowed characters must appear only once in the string, but can be repeated several times.

And finally, the $ sign ensures that the string ends with the allowed characters.

  1. Create a program in Python that allows the input of a text string, using regular expressions test if it is a valid email address.