Questions tagged [multiple-matches]
70 questions
58
votes
4 answers
select columns based on multiple strings with dplyr contains()
I want to select multiple columns based on their names with a regex expression. I am trying to do it with the piping syntax of the dplyr package. I checked the other topics, but only found answers about a single string.
With base R:
library(dplyr) …

agenis
- 8,069
- 5
- 53
- 102
20
votes
3 answers
Python regex to match multiple times
I'm trying to match a pattern against strings that could have multiple instances of the pattern. I need every instance separately. re.findall() should do it but I don't know what I'm doing wrong.
pattern = re.compile('/review:…

mavili
- 3,385
- 4
- 30
- 46
13
votes
2 answers
How to get multiple regex matches in Java?
How can I find all substrings that match a regex in Java? (Similar to Regex.Matches in .Net)

ripper234
- 222,824
- 274
- 634
- 905
7
votes
4 answers
Dropdown Javascript error: object doesn't support property or method 'matches'
I'm using the following JavaScript dropdown, which works perfect in all browers except the new Windows Edge.
It displays this error:
SCRIPT438: Object doesn't support property or method 'matches'
Script:
/* When the user clicks on the button,…

Jones
- 93
- 2
- 10
6
votes
3 answers
javascript regex to match multiple lines
my multiple string is something like below
###
some content
that I need to match
and might have some special character in it such as | <> []
###
I am trying to get the content of between hashes. I have tried below regex but it is not matching to it…

rawData
- 729
- 4
- 10
- 17
6
votes
1 answer
Replace all occurrences in a String by using regex in groovy
When there are only one occurrence my code works:
def result = "Text 1,1"
def matches = (result =~ /^.+\s([0-9],[0-9])$/ ).with { m -> m.matches() ? result.replace(/${m[ 0 ][ 1 ]}/, 'X'+m[ 0 ][ 1 ]+'X') : result }
assert "Text X,X" == matches
How…

Jils
- 783
- 5
- 12
- 32
5
votes
3 answers
Getting multiple matches within a string using regex in Perl
After having read this similar question and having tried my code several times, I keep on getting the same undesired output.
Let's assume the string I'm searching is "I saw wilma yesterday".
The regex should capture each word followed by an 'a' and…

Acsor
- 1,011
- 2
- 13
- 26
4
votes
1 answer
How can I get multiple Java regex matches on only certain lines
There is an API that I'm calling which I cannot change. That is, I cannot do this as two sequential regexes or anything like that. The API is written something like this (simplified, of course):
void apiMethod(final String regex) {
final String…

Matt Malone
- 361
- 4
- 25
4
votes
1 answer
OpenCV detect multiple instances of item
I've been exercising many tutorials and examples for OpenCV, mainly for feature detection and extraction.
I'm using C++, Visual Studio 2012, and open CV 2.4.11.
My ultimate goal will be to detect, identify, and count boxes of cereal on a shelf.…

user1247254
- 89
- 8
4
votes
2 answers
match text against multiple regex in python
I have a text corpus of 11 files each having about 190000 lines.
I have 10 strings one or more of which may appear in each line the above corpus.
When I encounter any of the 10 strings, I need to record that string which appears in the line…

okkhoy
- 1,298
- 3
- 16
- 29
2
votes
4 answers
How can I extract a varying number of groups of digits from a Perl string?
I am attempting to parse a string in Perl with the format:
Messages pushed to the Order Book queues 123691 121574 146343 103046 161253
I want to access the numbers at the end of the string so intend to do a match like
/(\d+)/s
My issue is that the…

Superpolock
- 3,515
- 7
- 30
- 24
2
votes
0 answers
Php regex, trying to exclude a match within another match
I have this regex to scan for each loops in my views, it almost does what I want, but not entirely. Im using this regex atm:
(?=({{each\s+([^{}]*)}}((?>(?!{{#?each).|(?1))*){{#each}}))
When I have an each-loop within another each-loop, it shows the…

Maarten Kuijper
- 304
- 1
- 5
- 17
2
votes
2 answers
RegEx multiple-matches in VB6
I have a text to scan like this:
-- FIRST BLOCK
Begin PRJFW_EDITM.TXT_EDITM TXT_CLIFOR
Height = 300
Left = 2685
DBField = "CG44_CLIFOR"
Caption = "Codice cliente fornitore"
…

epi82
- 497
- 2
- 10
- 21
1
vote
1 answer
Exact matching between a character vector with multiple patterns
I have hypothetical data.table
library(data.table)
names <- c("PARQUE NACIONAL VOLCáN ISLUGA", "CARIQUIMA","LASANA","YALQUINCHA","FALDA VOLCAN SAN PEDRO","EL MORRO (PARTICULAR)",
"SANTA ELENA PART.","PATACON (PARTICULAR)(TRABAJO SOCIAL)","MORHUILLA…

Rob
- 61
- 4
1
vote
1 answer
Search row for matching partial strings then concatenate strings in new column
Apologies if this is something really obvious but egads it's driving me crazy and I can't find a non-array/helper box answer.
I want to search cells D2 and E2 for matching numbers, and then concatenate these (using TEXTJOIN?) for each row in cell…

Emma_P
- 35
- 5