-2

I'm trying to find a regex to identify a pattern in which there is a word of minimum 3 characters followed by a dot and then a white space.

For example in the following sentence:

In the movie, Astaire sings the song to Rogers as they dance. The song was nominated for the Best Song Oscar for 1936

I would like to find the ". " that ends "Rogers as they dance. "

In the following sentences I don't want to get a match:

The Letters of T. S. Eliot and a facsimile of the draft of The Waste Land

There are two Dr. Who feature films: Dr. Who and the Daleks

Is there a regex expression that will achieve these conditions?

Udi Idan
  • 7,452
  • 9
  • 47
  • 80

2 Answers2

0

You can try this regex:

.*\w{3,}\.\s.*
programmer365
  • 12,641
  • 3
  • 7
  • 28
-1

I think you are searching for something that you can separate the word and the dot. so I wrote a regex for this problem , hope to be helpful:

(?<word>\\w{3,})(?<dot>\\.)\s

Explanation

as you are coding in java (one of your tags) I think you should use "\\" instead of "\". and for making easy to grouping the separations, I named the groups to word and dot.

Khayyam
  • 509
  • 3
  • 17
  • If you want to show us what a string literal looks like with double escaped sequences then you should surround it with quote marks just like a Java string literal – Patrick Parker Nov 13 '20 at 02:21
  • @PatrickParker thanks for advice, at the first I had a struggle with this problem, i will modify this again – Khayyam Nov 13 '20 at 02:24