ruby match all

# Sample input string
input_string = "Hello, 123.45 is the price, and 67.89 is the discount."

# Regular expression pattern to match all floating-point numbers
pattern = /\d+\.\d+/

# Using the `scan` method to find all matches in the input string
matches = input_string.scan(pattern)

# Output the matched floating-point numbers
puts matches

Explanation: 1. Define a sample input string containing some text and floating-point numbers. 2. Create a regular expression pattern (/\d+\.\d+/) to match all floating-point numbers in the input string. - \d+: Matches one or more digits. - \.: Matches the decimal point. - \d+: Matches one or more digits after the decimal point. 3. Use the scan method on the input string with the defined pattern to find all matches. This returns an array of matched substrings. 4. Output the array of matched floating-point numbers using puts.