Skip to content

Modify print statements for regex replacement example 18_Day_Regular_expressions#794

Open
anjalisilva wants to merge 1 commit intoAsabeneh:masterfrom
anjalisilva:patch-2
Open

Modify print statements for regex replacement example 18_Day_Regular_expressions#794
anjalisilva wants to merge 1 commit intoAsabeneh:masterfrom
anjalisilva:patch-2

Conversation

@anjalisilva
Copy link

Updated print statements to reflect output produced, from 'python' to 'JavaScript'.

Below statement would create desired print statement:

match_replaced = re.sub('Python', 'JavaScript', txt)
print(match_replaced)  # JavaScript is the most beautiful language that a human being has ever created. I recommend python for a first programming language

Below statement leads to all python being replaced with 'JavaScript'

match_replaced = re.sub('Python|python', 'JavaScript', txt, re.I)
print(match_replaced)  # JavaScript is the most beautiful language that a human being has ever created.I recommend JavaScript for a first programming language

Updated print statements to reflect changes in the replacement text from 'python' to 'JavaScript'.
@anjalisilva anjalisilva changed the title Modify print statements for regex replacement example Modify print statements for regex replacement example 18_Day_Regular_expressions Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant