How to match all occurrences of a regex

0 votes
Is there a quick way to find every match of a regular expression in Ruby? I've looked through the Regex object in the Ruby STL and searched on Google to no avail.
Nov 24, 2020 in Python by Rajiv
• 8,880 points
1,325 views

1 answer to this question.

0 votes

Using scan should do the trick:

string.scan(/regex/)
answered Nov 24, 2020 by Gitika
• 65,930 points

Related Questions In Python

0 votes
1 answer

How to replace all occurrences of a string?

The general pattern is str.split(search).join(replacement) This used to be ...READ MORE

answered Nov 26, 2020 in Python by Gitika
• 65,930 points
77 views
0 votes
1 answer

How to remove all of the data in a table using Django?

Hello @kartik, Inside a manager: def delete_everything(self): ...READ MORE

answered Aug 12, 2020 in Python by Niroj
• 82,780 points
321 views
0 votes
1 answer

How to get all links and all elements that are clickable on a page of system dynamically?

Hello, You can do it by using find_elements_by_xpath() driver ...READ MORE

answered Aug 27, 2020 in Python by Niroj
• 82,780 points
1,529 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,250 views
0 votes
0 answers
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,686 views
0 votes
1 answer
0 votes
1 answer

How to find all occurrences of a substring?

There is no simple built-in string function ...READ MORE

answered Nov 24, 2020 in Python by Gitika
• 65,930 points
78 views