I have been trying to grab a first location name inside the sentences. The desired location name will exactly starts at the 2nd capital of the first sentence and then precisely end before the first dot(.)
Example:
It is located at Supreme Court. Follow by some other text.
^ ^
Desired out put
Supreme Court
Sorry I can’t show you a piece of code that I’ve got so far. After an hour of trying, I got nothing in concrete.
If you show the code example in Ruby would be highly appreciated.
This regex :
Will produce :
Supreme CourtI start from the start of the string matching the first capital while ignoring everyhting else. I then match the 2nd capital and save the result into backreference 1 until the first dot.