troubleshooting Question

Splitting text by period using regular expressions in php

Avatar of srikanth saladi
srikanth saladi asked on
PHPRegular Expressions
13 Comments1 Solution778 ViewsLast Modified:
Hi,

I have a requirement,where i need to break a long sentence into single sentences using full stop as delimeter.

for example The text

$text = "Music, movies, games and voice calls in great stereo quality. An improved noise canceling microphone ensures you can be easily heard, even when people are talking around you. Position the fully flexible boom arm exactly where it needs to be for calls, or move it out of the way to game, watch movies or listen to your music."

Will split like this.

Music, movies, games and voice calls in great stereo quality.
An improved noise canceling microphone ensures you can be easily heard, even when people are talking around you.
Position the fully flexible boom arm exactly where it needs to be for calls, or move it out of the way to game, watch movies or listen to your music.

I have tried like this

$seperator = ". ";
$description = array();
$description = explode($seperator,$text);

But when the text contains any numeric data like (1.2 values) or any abbreviated words ft.4(feet).
The sentence will be splitting like this 1.
2 values

I want to excludes those numbers with decimals and abbreviated words when splitting.I know this can be done using regular expressions.Please suggest any idea on how this can be done.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros