Advanced Search Function 1/2
The Search function also provides some advanced matching combinations. We will now introduce the most famous one and later practice them in the exercise:
\A
- Matches if the specified characters are at the start of a string;\b
- Matches if the specified characters are at the beginning or end of a word;\D
- Matches any non-decimal digit. Equivalent to [^0-9];\d
- Matches any decimal digit. Equivalent to [0-9];\B
- Opposite of\b
. Matches if the specified characters are not at the beginning or end of a word;.
- period matches any single character.
Aufgabe
Swipe to start coding
- Import
re
. - Define a text variable as
"The cat in the hat"
. - Search for any 3 characters finishing with
"at"
. - Print the output.
Lösung
Mark tasks as Completed
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 3
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Suggested prompts:
Fragen Sie mich Fragen zu diesem Thema
Zusammenfassen Sie dieses Kapitel
Zeige reale Beispiele
Awesome!
Completion rate improved to 11.11
Advanced Search Function 1/2
The Search function also provides some advanced matching combinations. We will now introduce the most famous one and later practice them in the exercise:
\A
- Matches if the specified characters are at the start of a string;\b
- Matches if the specified characters are at the beginning or end of a word;\D
- Matches any non-decimal digit. Equivalent to [^0-9];\d
- Matches any decimal digit. Equivalent to [0-9];\B
- Opposite of\b
. Matches if the specified characters are not at the beginning or end of a word;.
- period matches any single character.
Aufgabe
Swipe to start coding
- Import
re
. - Define a text variable as
"The cat in the hat"
. - Search for any 3 characters finishing with
"at"
. - Print the output.
Lösung
Mark tasks as Completed
War alles klar?
Danke für Ihr Feedback!
Abschnitt 1. Kapitel 3