So I have a really long string and I want to work with multiple matches. I can only seem to get the first position of the first match using regexpr
. How can I get multiple positions (more matches) back within the same string?
I am looking for a specific string in html source code. The titel of an auction (which is between html tags). It prooves kind of difficult to find:
So far I use this:
locationstart <- gregexpr("<span class="location-name">", URL)[[1]]+28
locationend <- regexpr("<", substring(URL, locationstart[1], locationend[1] + 100))
substring(URL, locationstart[1], locationstart[1] + locationend - 2)
That is, I look for a part that comes before a title, then I capture that place, from there on look for a "<" indicating that the title ended. I'm open for more specific suggestions.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…