Questions tagged [last-occurrence]

The last occurrence is the first occurrence starting backwards. Used for questions related to finding the last occurrence of specified data in a data set, matching the last occurrence of a pattern match from a string, or referencing the previously found occurrences.

The last occurrence is the first occurrence starting backwards. Used for questions related to finding the last occurrence of specified data in a data set, matching the last occurrence of a pattern match from a string, or referencing the previously found occurrences.

50 questions
2
votes
4 answers

last year occurrence from string

I have strings like this: ACB 01900 X1911D 1910 1955-2011 3424 2135 1934 foobar I'm trying to get the last occurrence of a single year (from 1900 to 2050), so I need to extract only 1934 from that string. I'm trying with: grep -P -o…
Kintaro
  • 178
  • 3
  • 14
2
votes
5 answers

Python find last occurence in a file

I have a file with different IP's. 192.168.11.2 192.1268.11.3 192.168.11.3 192.168.11.3 192.168.11.2 192.168.11.5 This is my code until now. Where I print the IP and the occurence, but how can I found out when the last occurennce was for each of…
user4647247
2
votes
2 answers

ColdFusion - Last Occurence of a string using RefindNoCase

I am using RefindNoCase to find the last occurrence of a string. This is the code I am using: This is supposed to return an array with positions and length for each…
BlackM
  • 3,927
  • 8
  • 39
  • 69
2
votes
2 answers

How could I get the last occurrence of [0] using regular expression?

I'm trying to get the last occurrence of a situation. obj.foo[0].bar[0].name I try this code but just got the first [0] and if I put $ at end just doesn't work. \[(\d+)\](?:(?!\[\d+\]))
2
votes
3 answers

Perl word disenvoweling: removing all vowels except the first and last

In order to shorten a number of names, but still keep them somewhat readable, I would like to remove all vowels from strings, except for the first and last occurrence. For example, I'd like 'Minnesota' to become 'Minnsta'. my…
meuleman
  • 378
  • 1
  • 7
1
vote
0 answers

ANSI SQL 92: find last occurrence of character

I need a ANSI SQL 92 statement to change all characters following the last '/' character to lower case. On Sybase I would write: update table set col = left(col, len(col)-charindex('/', reverse(col))) || lower(right(col, charindex('/',…
ph8c4
  • 96
  • 1
  • 7
1
vote
1 answer

regex for text between last occurrence of : and .tst

As an example I have string that is Banjo.ald:Mandolin.ald:Guitar.tst and I am trying to find the regex that will return the string Guitar. In the example above I have two groups preceding the text I am interested in (i.e. Banjo.ald:Mandolin.ald:)…
Janus
  • 13
  • 2
1
vote
6 answers

Finding the last occurrence of a word

I have the following string: electric cu hello rent islove, mind I want to find the last "SEM" start tag before the "PARTITION" tag. not the SEM end tag but the start tag. The result should be: is…
shabby
  • 3,002
  • 3
  • 39
  • 59
1
vote
1 answer

Notepad++: last occurrence of string

I want to find the last occurrence of a string in a large text file in Windows. Is there a way to do this using Notepad++ (also do suggest methods beyond Notepad++ if you know a better method)? I don't want to install any add-on or anything else, if…
jgoh
  • 47
  • 1
  • 10
1
vote
0 answers

Get last occurance of a Lua pattern with string.match

With Lua I am parsing the last occurrence of an XML tag from a large XML string using the pattern: local firstPattern = "(.-)" I then used the following code to find every occurrence: local lastMatch for match in string.gmatch(xmlString,…
blakem
  • 11
  • 2
1
vote
3 answers

Getting last occurrence of a string using regular expressions

I need to parse an HTML file and i've got something like this: TEXT_TO_FIND KEY Taking into account that there are multiple levels…
Mosty Mostacho
  • 42,742
  • 16
  • 96
  • 123
1
vote
1 answer

I want to open a file and replace last occurrence pattern of string in perl

I have done this so far but its still not working. open (GOOD_FILE,"<$pre.XXX.XXX$post") or die "Cannot open XXX"; # temporarily undefine the input line separator to read the entire file at once: my $text = do { local $/; }; close…
mysteriousboy
  • 159
  • 1
  • 7
  • 20
0
votes
3 answers

counting number of words after last occurrence of every word in an array of strings

i am working on text. I want to find the number of words after the last occurrence of a particular word in an array of strings.For instance, String[] array={cat,rat,cat,bat,cat,cat,bat,fat,mat} and I want to find the last occurrence of every word in…
0
votes
0 answers

Find differences in dates between last occurence in rows in dataframe in python

I have a data frame (with columns for NHL team, opponent, goals for, goals against, home/away, win) that looks like this: It is sorted by date. What i want to do is calculate a new Rest column. This will be populated with the number of days since…
SR34
  • 37
  • 1
  • 5
0
votes
1 answer

simplify the code to find the last occurrence of a value

I have a four dimensional array [time, model number, longitude, latitude] which contain values 0 and 1. i want to find last location of zero in that array with respect to time series (which year is the last time zero occurs].I want to do it for…