Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
salman23
Visitor

paragraph not splitting as sentences..

Hi,
i am using roRegex component for splitting the description paragraph into strings by using ". " as the delimiter.But i am getting a weird output.Can somebody help please..?

code:
if valid(videodesc)
SplitDesc = CreateObject("roRegex",". ", "")
if SplitDesc.IsMatch(videodesc)
FinalDesc =""
print "contains :";regex
print "description: ";videodesc
descCase = SplitDesc.split(videodesc)
print "no of sentences :";descCase.Count()
for each descript in descCase
print "each sentence :";descript
' FinalDesc = FinalDesc + descript
end for
' videodesc = FinalDesc


else
print "no matching expression found.."
end if


output:

description: The full feature documentary of Indie Game: The Movie with clean audio and visuals. Audio swears omitted and potentially offending images and swear
s on screen blurred. The Super Clean version is also available in a handy, gift-able DVD form: http://shop.indiegamethemovie.com/produ ... -the-movie

no of sentences : 40
each sentence :Th
each sentence :ful
each sentence :featur
each sentence :documentar
each sentence 😮
each sentence :Indi
each sentence :Game
each sentence :Th
each sentence :Movi
each sentence :wit
each sentence :clea
each sentence :audi
each sentence :an
each sentence :visuals
each sentence :Audi
each sentence :swear
each sentence :omitte
each sentence :an
each sentence :potentiall
each sentence :offendin
each sentence :image
each sentence :an
each sentence :swear
each sentence 😮
each sentence :scree
each sentence :blurred
each sentence :Th
each sentence :Supe
each sentence :Clea
each sentence :versio
each sentence :i
each sentence :als
each sentence :availabl
each sentence :i
each sentence :
each sentence :handy
each sentence :gift-abl
each sentence :DV
each sentence :form
0 Kudos
2 REPLIES 2
renojim
Community Streaming Expert

Re: paragraph not splitting as sentences..

In a regular expression, . matches any character. You need to escape the period. I think you want (untested:)
SplitDesc = CreateObject("roRegex","\. ", "")

You may want to look into the Tokenize function:
lines = videodesc.tokenize(".")
for each line in lines
print line.trim()
end for


-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
salman23
Visitor

Re: paragraph not splitting as sentences..

"renojim" wrote:
In a regular expression, . matches any character. You need to escape the period. I think you want (untested:)
SplitDesc = CreateObject("roRegex","\. ", "")

You may want to look into the Tokenize function:
lines = videodesc.tokenize(".")
for each line in lines
print line.trim()
end for


-JT



It was a great information, Renojim. Thanks a bunch.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.