xxxxxxxxxx
/*get only numbers from string*/
str.replace('Rs. ', '').replace(/,/g, '');
or
str.replace(/Rs. |,/g, '');
/,/g is a regular expression. g means global
/Rs. |,/g is a single regular expression that matches every occurence of Rs. or ,
xxxxxxxxxx
import re
def get_digits_from_string(input_string):
digits = re.findall(r'\d+', input_string) # find all numerical digits in the string
return ''.join(digits) # concatenate the found digits into a single string
# Example usage
input_string = "abc123xyz456"
numbers = get_digits_from_string(input_string)
print(numbers) # Output: 123456