Python: Metacharacters

Post Reply
User avatar
Jason
Site Admin
Posts: 767
Joined: Sun Dec 21, 2025 8:56 pm

Code: Select all

import re

about_band_performance = "Shocking Blue performs the song Venus."

band_name = re.findall("^Sho.*ue$", about_band_performance)

# Read: String or strings found must start with "Sho" and be followed by any character with zero or more occurrences to be followed by "ue"

print(band_name)

# Displays ['Shocking Blue']
 

POSTREACT(ions) SUMMARY

Post Reply