File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -33,22 +33,22 @@ test_url = "https://www.google.com"
3333if tester.match(test_url):
3434 print " Valid URL"
3535
36- # Print the generated regex
36+ # Print the generated regex
3737print tester.source() # => ^(http)(s)?(\:\/\/)(www\.)?([^\ ]*)$
3838```
3939### Replacing strings
4040``` python
41- # Create a test string
41+ # Create a test string
4242replace_me = " Replace bird with a duck"
4343
44- # Create an expression that looks for the word "bird"
44+ # Create an expression that looks for the word "bird"
4545expression = VerEx().find(' bird' )
4646
47- # Execute the expression in VerEx
47+ # Execute the expression in VerEx
4848result_VerEx = expression.replace(replace_me, ' duck' )
4949print result_VerEx
5050
51- # Or we can compile and use the regular expression using re
51+ # Or we can compile and use the regular expression using re
5252import re
5353regexp = expression.compile()
5454result_re = regexp.sub(' duck' , replace_me)
You can’t perform that action at this time.
0 commit comments