Consider like I have a string :
stringA = "values-are-10-1,20-2,30-1,40-4,50-3"
I need to get only the strings : desired output :
for stringA: 10-1,20-2,30-1,40-4,50-3
Could you please help me in getting regex for this.
>Solution :
I suggest you use regex module:
import re
stringA = "values-are-10-1,20-2,30-1,40-4,50-3"
re.sub("[^0-9\-\,]", "", stringA).strip("-")
Output
10-1,20-2,30-1,40-4,50-3