Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to match a full stop at the end of each sentence in a paragraph of text.

There must be atleast 3 words before the fullstop(.)

This is to ensure only full stops at the end of sentences are counted. Periods in Microsoft v 3.2.1 are skipped! Please note that the words may not necessarily contain latin characters. I plan to use in other languages so we can't use [a-Z] here!

What i tried .+s+.+s+.+[.] But this selects the whole sentence!

Probably one can use a if else construct? if .+s+.+s+.+[.] is found, select the dot or else don't. Is it possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
186 views
Welcome To Ask or Share your Answers For Others

1 Answer

Ok. Here's a go at it:

(?:(?:s|^|.)[^sd.]+){3}(.)

Expl.: (Non capturing) find a space, full stop or start of line followed by any number (at least one) of characters that isn't a space, digit or a full stop. Repeat this 3 times. Then capture a full stop :D Done!

Check it out here.

Regards


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...