Questions tagged [overlapping-matches]

55 questions
97
votes
8 answers

Check overlap of date ranges in MySQL

This table is used to store sessions (events): CREATE TABLE session ( id int(11) NOT NULL AUTO_INCREMENT , start_date date , end_date date ); INSERT INTO session (start_date, end_date) VALUES ("2010-01-01", "2010-01-10") , ("2010-01-20",…
Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307
9
votes
3 answers

Find overlapping dates for each ID and create a new row for the overlap

I would like to find the overlapping dates for each ID and create a new row with the overlapping dates and also combine the characters (char) for the lines. It is possible that my data will have >2 overlaps and need >2 combinations of characters. …
sar
  • 182
  • 6
  • 26
6
votes
2 answers

Overlapping pattern matches

I have the following code: test :: String -> Bool test "g" = True test "global" = True test _ = False When I load it into GHCi (7.0.3), I get: Warning: Pattern match(es) are overlapped In an equation for `test': test "g" = ... Is this a…
Thomas Eding
  • 35,312
  • 13
  • 75
  • 106
6
votes
4 answers

Meaning of overlapping pattern in Haskell

My current understanding of pattern overlapping in Haskell is that 2 patterns are considered to be overlapping if some argument values passed to a function can be matched by multiple patterns. Given: last :: [a] -> a last [x] = x last (_ : xs) =…
Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169
5
votes
6 answers

C# multiple string match

I need C# string search algorithm which can match multiple occurance of pattern. For example, if pattern is 'AA' and string is 'BAAABBB' Regex produce match result Index = 1, but I need result Index = 1,2. Can I force Regex to give such result?
matko
5
votes
3 answers

Collapse a list of range tuples into the overlapping ranges

I'm looking for the most memory efficient way to solve this problem. I have a list of tuples representing partial string matches in a sentence: [(0, 2), (1, 2), (0, 4), (2,6), (23, 2), (22, 6), (26, 2), (26, 2), (26, 2)] The first value of each…
Francisco Roque
  • 431
  • 4
  • 14
4
votes
3 answers

Comparing overlapping ranges

I'm going to ask this question using Scala syntax, even though the question is really language independent. Suppose I have two lists val groundtruth:List[Range] val testresult:List[Range] And I want to find all of the elements of testresult that…
Ken Bloom
  • 57,498
  • 14
  • 111
  • 168
4
votes
2 answers

Find all substrings within a string with overlap

Hi im trying to find all overlapping substrings in a string here is my code its only finding nonrepeating ACA. $haystack = "ACAAGACACATGCCACATTGTCC"; $needle = "ACA"; echo preg_match_all("/$needle/", $haystack, $matches);
lolsharp
  • 69
  • 1
  • 11
4
votes
6 answers

Regex split into overlapping strings

I'm exploring the power of regular expressions, so I'm just wondering if something like this is possible: public class StringSplit { public static void main(String args[]) { System.out.println( java.util.Arrays.deepToString( …
polygenelubricants
  • 376,812
  • 128
  • 561
  • 623
3
votes
1 answer

Given date ranges and corresponding IDs, find groups of IDs with overlapping dates

I have a table with dateRanges and corresponding IDs. I want to group the IDs based on whether their start/end range overlaps with the date range for another ID. If a date range for an ID is partially or completely within that for another ID, they…
CorerMaximus
  • 653
  • 5
  • 15
3
votes
1 answer

python - how to get overlapping text matches in regex

I am using the following to get all matches including overlapping as per recommendations on other threads: [(m.start(0), m.end(0)) for m in re.findall(t,s,overlapped = True)] where t is a subset of s. However, I get the following error: Traceback…
user1764359
  • 97
  • 10
3
votes
1 answer

In java, when using regex to find patterns, how to get nested result?

The case is that, I want to find string which satisfies "c+d" in a string "cccd". My code is as follows, String str="cccd"; String regex="c+d"; Pattern pattern = Pattern.compile(regex); Matcher matcher =pattern.matcher(str); While(matcher.find()){ …
Maytree23
  • 125
  • 1
  • 10
2
votes
1 answer

REGEX for overlapped/intermingled rows

I have this really irritating problem resulting from a dodgy PDF digitisation. Anyway, a series of rows with different columns, ideally, would be represented like this: Code Cost Quantity ABC 45.00 4 FED 60.00 5 GHK 30.00 5 With regex it is…
2
votes
4 answers

Regex to find sequential integers

I am having a difficult time getting my regular expression code to work properly in PHP. Here is my code: $array = array(); // Used to satisfy the 3rd argument requirment of preg_match_all. $regex =…
Tonto McGee
  • 495
  • 1
  • 4
  • 6
2
votes
2 answers

Functionality of as-pattern, non overlapping pattern through 'as pattern'

I am new to functional programming and haskell in particular and have two questions abound as-pattern and the reduction of overlappings through using it. Giving the following code example: last1 :: [a] -> a last1 [x] = …
froehli
  • 904
  • 1
  • 11
  • 35
1
2 3 4