Using Re with Python to Extract Substring

Python

 1|  import re
 2|  
 3|  string = 'Clothing Brand - Nike'
 4|  search_result = re.search('Clothing Brand - (.*)')
 5|  brand = search_result.group(1)
 6|  print(brand)
 7|  
 8|  ***
 9|  OUTPUT
10|  ***
11|  
12|  > Nike
Did you find this snippet useful?

Sign up for free to to add this to your code library