Search code examples
pythonregexnumbersdigits

see numbers in regex with out special character


I just want to see numbers with out this special character "," comma with regex in python, number are like this: 143,000 is price 126,479,000 hours you worked and i just want to see full match like this: 143000 126479000


Solution

  • import re
    
    
    my_text = '1,222,222 test'
    
    my_out = re.search(r'[0-9|,]{1,}',my_text).group().replace(',','')
    
    print(my_out)